The error callback is defined as:
Type: Function( jqXHR jqXHR, String textStatus, String errorThrown )
The complete callback is defined as:
Type: Function( jqXHR jqXHR, String textStatus )
I'd like to be able to get the errorThrown
property from within my complete
callback. Is it available as part of the jqXHR object?
complete
is called after error
but I'd like to avoid some sort of hack that saves the errorThrown
value so it can be used in complete
.
I suppose you could attach the value to the jqXHR object in the error callback, so long as jQuery passes the same object to both callbacks:
error: function(jqXHR, textStatus, errorThrown) {
jqXHR.errorThrown = errorThrown;
},
complete: function(jqXHR, textStatus) {
console.log(jqXHR.errorThrown);
}
fiddle demonstrating the general concept: http://jsfiddle.net/9kQna/