0

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?

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Not exactly what I'm searching for, but this seems the nearest approach for this question that works. Thanks!
ok goodluck =) just tell us if you will encounter any problems
0

Use this:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.