I used this code from Change table cell from span to input on click- The replace one for inline edit now i want to post values through ajax and i am not sure how. I just want to post the comments the users have edited and update them on the database This is how i got so far:
$.ajax({
type: "POST",
url: "comments.php",//to update the comments
data: "data"
});
Not sure what to put next. Is it possible to post values when user click out of input area? and does the data have to be serialize
?
Thanks in advance!
$.ajax({
type: "POST",
url: "comments.php",//to update the comments
data: {"comments":$("yourformId").serialize()},
success:function(res)
{
//Do what ever you want
}
});
And in your comments.php
just print_r($_POST)
will give you the posted array via ajax
If you use form.serialize
you will get all the data from the form you submitted