I'm using ajaxSetup
to handle all errors generally:
$.ajaxSetup({
error: handleErrors
});
var handleErrors = function(xhr) {
console.log('this is ');
console.log(this);
};
In this case, this
is the global scope.
However, if I have an indiviudal error handler for each call:
$.ajax({
error: function(xhr){
console.log('this is ');
console.log(this);
},
...
The this
is the ajax request that was sent, with url, type, contentType etc. How would I get access to that information in my general handleErrors
function? So if it fails, I know specifically the request that has failed?