Trying to figure out $.post callback functionality for jQuery
I have a jquery script that is working fine except being able to send the data via $.post and receive a response back开发者_JAVA技巧. here is the relevant code:
$.post(
'test.php',
{ userfname: f.editfname, userlname: f.editlname, userid: v.user },
callback: function(data) {
$.prompt('You have successfully added this book to your cart!');
}
);
I want the results of test.php to be placed inside the results div
The code contains invalid syntax. Try this:
$.post('test.php',
{
userfname: f.editfname,
userlname:f.editlname,
userid:v.user
},
function(data)
{
$.prompt('You have successfully added this book to your cart!');
});
Like this you mean?
$("div#results").html(data);
精彩评论