JQuery 1.6.4, Firefox 7
I can successfully make CORS (Cross-domain) requests with JQuery. However, I can't seem to examine the HTTP Response Headers after an error.
Any suggestions?
- $.ajax({
- url: 'http://anotherdomain/gives500errorback',
- success: function(a, b, c){
- // do something with a success
- },
- crossDomain: true,
- async: false, // tried true also
- error: function(xhr, textStatus, errorThrown)
- {
- var status = xhr.getAllResponseHeaders();
- alert("Status is empty! Oh no! status = " + status);
- }
- });
Status is an empty string.
The textStatus and errorThrown parameters in the error callback are not particularly helpful as I want to display the information from the remote service, and these parameters are different errors that appear to be jquery specific.
Other research I've done:
This post:
http://forum.jquery.com/topic/jquery-how-to-get-the-response-header-of-an-ajax-request suggests I should be able to use the XMLHttpResponse object to inspect the HTTP response headers, as does the w3schools page here:
http://www.w3schools.com/dom/dom_http.asp. However, the XMLHttpResponse object simply doesn't have the values set when I'm dealing with JQuery.
This post appears to be not related as the person solved the problem by using JSONP, which is not a possibility for me.
http://forum.jquery.com/topic/get-response-headers-cross-domain