Suppose that I have some global Ajax event handlers defined (ajaxStart, ajaxStop, and ajaxError). Usually I am fine with that, but for one request, I want to disable the aja
It's possible and not difficult to do.
You just need to setup your global error handler (.ajaxError) to receive a few of the parameters that jQuery can provide to it:
$("div.log").ajaxError(function(evt, xhr, settings) {
if(settings.suppressErrors) {
return;
}
// Normal processing
});
After this, you can add suppressErrors: true to the settings of any AJAX request you make, and if it fails the error handler will return without doing what it normally does.
See it in action.