Cross-domain AJAX requests (made using jQuery 1.7.2) are not performed in IE9 unless the request dataType is set to "jsonp" or "script".
I discovered this issue in framing a request where I did not care about the response and left dataType unspecified (yes, I know I should care about the response).
So, for example, this will work:
$.ajax({
url: "http://www.google.com",
type: "GET", // or "POST"
dataType: 'jsonp'
});
But this won't:
$.ajax({
url: "http://www.google.com",
type: "GET" // or "POST"
});
By "work" I mean that I see an HTTP request made in Firebug or F12.
Both requests work in other browsers. Setting jQuery.support.cors = true;
does not affect success, nor does setting crossDomain to true nor cache to false (in the AJAX request).
Why should the success of an AJAX request depend on the dataType requested in just IE? I can understand why it would affect my ability to work with any returned data; I also understand that some servers might reject all requests for a certain dataType (but that is apparently not the case here).
This is not a question of datatype but of clearly verifying, in the browser, that the server really wants to answer this query.
By imposing JSONP you force the server to have a very specific answer (including the method call).
Note that there are now other solutions : you can set, on the server, specific headers (see https://developer.mozilla.org/en-US/docs/HTTP_access_control)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With