ajaxSuccess not triggered
I have this short and simple code below but ajaxSuccess didn't get called. Any idea why?
$.ajax({
type: "GET",
async: true,
url: "/userprofile",
data: {
'username': username
},
开发者_C百科 error: function (xhr, status, error){
}
});
$().ajaxSuccess(function(event, request, settings) {
alert("OK");
});
Try this instead:
$.ajax({
type: "GET",
async: true,
url: "/userprofile",
data: {
'username': username
},
success:function(res){
alert(res);
},
error: function (xhr, status, error){
/////
}
});
usually i will put the success inside the .ajax()
call, but if you do it this way, it seems like you need to specify the selector as in the docs:
http://api.jquery.com/ajaxSuccess/
精彩评论