I tried using jquery.ajax but it fails silently whenever there is an error response
Asked
Active
Viewed 165 times
2
-
1did you set the `error` function to handle errors? – Tim Withers Jul 29 '12 at 07:59
-
Yeah, the `error` callback should have this information. Show the code you are using – Pekka Jul 29 '12 at 08:09
1 Answers
0
No, this is not possible without any workaround.
When making cross-domain (JSONP) requests, jQuery doesn't trigger an error event, see this answer on SO.
If it's sufficient for you to know that there was an error (without getting additional info), you could try something like this, combined with this.
If you really need the HTTP status code, you will have to work server-side, i.e. use your own server as a proxy to get the cross-domain resource. Then you can send additional info to JS using the JSONP callback; see this solution on SO.
Sorry for posting so many links, but I guess that's better than quotations... ;)