I created a convenient method that adds a default error handler for my ajax calls:
function myAjaxFunction(url, data) { return $.ajax({ url: url, data: data }).fail(myErrorHandler); }
So far, this works fine, because now I do not need to specify the error handler function in 50 different places.
But sometimes I need to override the default error handler with a custom one. However, when I do this, it calls both error handlers:
myAjaxFunction("myurl", "mydata").fail(myCustomErrorHandler).then(doSomething);
How do I get it to override or remove the previous error handler from the chain?
source share