jQuery Ajax and error handling
I'm having trouble finding documentation on the jQuery ajax error. I'd like to create a function that is able to get the name of the web service that was called in order to report the error.
Is there a way in the error function to get the name of the function called?
error: function() {
//not sure what i开发者_开发技巧s available here
}
I'd appreciate any documentation on what's available in the error function.
Have a look at this question: jQuery Ajax error handling, show custom exception messages
The error function is :
error:function (xhr, ajaxOptions, thrownError){
console.dir(xhr);
console.dir(thrownError);
}
Where xhr is the XMLHttpRequest. You can use FireBug's console.dir to get its attributes.
精彩评论