getJSON or AJAX requests not working with IE9
Did you try using getJSON()
instead of ajax? This is a cross-domain request and you're fetching json so that it probably the problem.
It's working in both browsers now:
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20script%20from%20html%20where%20url%3D%27https%3A%2F%2Ftesting.website.com%2F%3Fcid%3D48hgfd45430DD%26id%3D4830F8CF0454312%27&format=json&diagnostics=true&_maxage=86400&callback=?",function(){ alert('hi');});
The problem of IE9 depends on advanced cache management.
If you empty the cache of IE and re-run the ajax request: the first time will work.
To resolve this problem you must send your HTTP response with "noStore = true" and "Duration = 0" or equivalent.
Here is an example in MVC.
Using $.getJSON
or $.ajax
you must also specify dataType
parameter 'jsonp'
Here the example using getJSON:
var webpage = ".... your very long url ....";var anchor = document.createElement('a');anchor.href = webpage;// handle the multiple parametersanchor.search += ((anchor.search.length > 0) ? "&" : "?");anchor.search += "callback=?";$.getJSON(anchor.href, 'jsonp', function(data, textStatus, jqXHR){ alert('hi');});