I have a jquery code in which I am using get() and calling some remote url/file. Now I want to know what the best way is to handle errors from this.
What I am doing
copy/paste from http://api.jquery.com/jQuery.ajax/:
statusCode(added 1.5) {}
A map of numeric HTTP codes and functions to be called when the response has the corresponding code. For example, the following will alert when the response status is a 404:$.ajax({ statusCode: {404: function() { alert('page not found'); } });If the request is successful, the status code functions take the same parameters as the success callback; if it results in an error, they take the same parameters as the error callback.