In $.ajaxSetup.success
I want a general piece of code to check something and then the $.ajax.complete
callback should not be called. Is this possible? Preferably by doing something in the $.ajaxSetup.success
callback and not in every $.ajax.complete
callback.
event.stopImmediatePropagation
might work, but I don't know how to access event
from success
.
$.ajaxSetup({
success : function(jqXHR, textStatus, errorThrown) {
alert('this will happen');
}
});
$.ajax({
url: '/echo/json/',
type: 'POST',
complete: function () {
alert('this shouldn\'t happen');
}
});
jsFiddle: http://jsfiddle.net/z4L4z3oo/1/