I seem to have found an undocumented breaking change in jQuery 1.8.3.
While upgrading a page from jQuery 1.7 to 1.8.3 one of our ajax calls of type “HEAD” stopped working.
Upon debugging the success callback is fired but the parameter, “xhr” is null when I use the google CDN to run the page in jQuery 1.8.3.
If I switch back to 1.7 the xhr object is fully operational and not null.
I have scoured google and jQuery site for breaking changes in 1.8.* but can find nothing on point. I need to upgrade this as another library I need to use requires the latest jQuery so I am now between a rock and a hard place.
Code is as follows:
$.ajax({
type: "HEAD",
async: false,
cache: false,
url: pth + b,
error: function (xhr) {
// always succeeds
},
success: function (xhr) {
// in jQuery 1.7.0 ONLY xhr is a non-null object - 1.8.3/1.9.0 receive a null object as a parameter
c = xhr.getResponseHeader('x-amz-meta-mix');
if (c == null) c = b;
}
});
Thanks!
PS- I should add that in Fiddler the response is always 200 and the information I am looking for is always present. The issue is that the xhr object is null if I do not use jQuery 1.7.0 in favor of 1.8.3 or 1.9.0
It seems that jQuery has changed the format of the
successcallback. In 1.8 and later it is:The
jqXHRis now the third argument, rather than the first, so change yoursuccesshandler to: