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
精彩评论