2

I tried using jquery.ajax but it fails silently whenever there is an error response

1 Answers1

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... ;)

Community
  • 1
  • 1
Aletheios
  • 3,960
  • 2
  • 33
  • 46