开发者

problem adding success to jquery post

I have this code here and want to attach a success function but dont know how. Can anyone please advise?

$.post('SendEmail.aspx',
         {emai开发者_C百科lbody: emailBody})


See the examples, it's pretty straightforward.

http://api.jquery.com/jQuery.post/


$.post('SendEmail.aspx', {emailbody: emailBody}, function(result) {
    //success function here
})

EDIT

If you want to handle errors, you need to call the full $.ajax() function like this:

$.ajax({
    type: 'POST',
    url: 'SendEmail.aspx',
    data: {emailbody: emailBody},
    success: function(result){ //success function code},
    error: function(result){ //error function code},
    dataType: 'json'
});

Check out this link for all the ajax settings

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜