Reputation: 981
There must be something I don't get here. I request a url that respond with a 404, so the following code works:
$.ajax({
url: '/echo/error',
success: function(){
alert('that was a success');
},
error: function(){
alert('error');
},
complete: function(){
alert('complete');
}
});
It will alert "error" then "complete". That's fine.
The problem is that if i add this before:
$('document').ajaxError(function(){
alert('ajaxError');
});
$('document').ajaxComplete(function(){
alert('ajaxComplete');
});
I never get "ajaxError" or "ajaxComplete". What am I doing wrong ? (I'm using jQuery 1.9.1)
Here is the fiddle: http://jsfiddle.net/CQmZ8/
Upvotes: 0
Views: 434
Reputation: 981
Use $(document) instead of $('document').
Thank you A. Wolff for the quick answer.
Upvotes: 1