开发者

Trying to figure out $.post callback functionality for jQuery

开发者 https://www.devze.com 2023-03-15 07:57 出处:网络
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:

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消