I'm trying to handle AJAX errors in a web application that uses jQuery.
I'm setting up an event handler to deal with AJAX errors like this:
$('body').ajaxError(error_handler);
However, despite the information that's passed to that handler, I'm finding it difficult to determine what sort of error occured.
The two errors I'm interested in identifying are:
- When the application server is down
- When I've used
$.getJSON(...)
and the response isn't parsable as JSON data.
Both of these cause my error handler to fire, but I need to handle each error differently, and don't know how I can do this.
Does anyone have any suggestions?