I'm working on a site that has a global Ajax error handler in the main page template, like this:
$(document).ajaxError(function (event, request, settings, thrownError) {
postError(thrownError);
})
This updates the page with information about an error from an Ajax request. I am working on a specific Ajax call where I need errors to be handled differently, it will just silently select a value without doing anything about the error. The function is in a handler for a DevExtreme SelectBox that must return a Promise
:
return $.ajax({
// stuff
}).fail(function (request, status, error) {
// set value
});
This does what its supposed to in regards to setting the value, but the Ajax error handler still fires. I've tried setting the error to null in the .fail()
function but it still gets posted. Is there a way to disable the ajaxError
handler for just this one call?