The following AJAX call is failing in IE.
$.ajax({ url:"{{SITE_URL}}/content/twitter.json", dataType:"json", error:function(xhr, status, errorThrown) { alert(errorThrown+'\n'+status+'\n'+xhr.statusText); }, success:function(json) { ...Snip... } });
The error function returns
Undefined parsererror OK
No request is made to the server so I don't think its a problem with the JSON.
Fixed, See #1351389
The jQuery ajax fail is an ajax event which is only called if the request fails. The AJAX fail is a global event that triggered on the document to call handler function, which may be listening. The ajax fail can be performed with the help of the ajaxError () function. The jQuery ajaxError () function is a built-in function in jQuery.
We can use the fail () callback function as well on the JavaScript promise object ( the jqXHR object return by the $.ajax () function) to run the specific function on the ajax request fail. $ (document).ajaxError (function (event, xhr, options, exc)); function (event, xhr, options) – This is not an optional parameter.
Once IE has successfully made a GET request, it will no longer even make that AJAX call until the cache expires on that object. Fortunately, fixing the issue is easier than identifying it. There are several ways to prevent AJAX requests from being cached. One option is to simply use POST requests instead of GET requests in your application.
But if the request is fails the fail () callback function used to call on the jqXHR object return by the ajax () function and display the notification message of the request as “.fail (function (jqXHR, textStatus, errorThrown) { alert (“The request generate error”); })”.
Fixed, I changed the content-type from application/json; charset=utf8
to just plain application/json
.
I hate IE :)
Also to avoid IE super-caching try this:
var d = new Date(); $.ajax({ url:"{{SITE_URL}}/content/twitter.json?_="+d.getTime(), ...Snip...
That way each request is a new url for IE to get :D
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