I have the following code for default jQuery AJAX error handling:
$.ajaxSetup({
error : function(jqXHR, textStatus, errorThrown) {
alert("Error: " + textStatus + ": " + errorThrown);
},
statusCode : {
404: function() {
alert("Element not found.");
}
}
});
However, when 404 happens, BOTH functions are upcalled: first error, then statusCode, so I see 2 consecutive alerts.
How to prevent this behaviour and get error callback only if statusCode was not upcalled?