Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I'm using jquery AJAX to instant save things, however when an ID already exists it will give a hidden element with data in it. Which is already given as the 'right' syntax for $.ajax data.

I'm returning something like this:

{'km' : '43223432', 'id' : '2', 'date' : '15-01-2014'}

All values can be different ofcourse.

However; if this is returned, the user can click on a button to 'overwrite' the data. Data is stored in: $(".errorLogContent")

    var text = $(".errorLogContent").text(); 
$.ajax({
    type: "POST",
    url: "../uitvoer/overschijf.php",
    data: text
});

Why isn't this working?

share|improve this question
up vote 1 down vote accepted

don't send data without parameter name... let's say the name of the parameter will be param

do it like this

$.ajax({
    type: "POST",
    url: "../uitvoer/overschijf.php",
      data: { 
         myparam:text //set it with a parameter name
      }
});

in overschijf.php file you will receive the text as

$_POST['myparam'];

reference: http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings

share|improve this answer
    
Not exactly what I'm searching for, but this seems the nearest approach for this question that works. Thanks! – MikaldL Jan 20 '14 at 8:37
1  
ok goodluck =) just tell us if you will encounter any problems – Olga Real Jan 20 '14 at 8:39

Use this:

$.ajax({
    type: "POST",
    url: "../uitvoer/overschijf.php",
    data: {
       data: text
    }
});
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.