I have been trying to solve this problem for hours (searched here as well but none of the solutions worked) so I had no other option but to hope for someone to tell me why this is happening and how can I fix it.
This is a simple code that works with Firefox but not with IE9 (don't have other versions)
Example code is here:
Source is this one:
$.ajax({
url: "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",
success: function(){
alert('hi');
}
});
The website doesn't need to be real for testing purpose.
As you can see in the fiddle under Firefox, an alertbox appears saying "hi" BUT if you run the exact same code in IE9, the alertbox doesn't appear.
The same situation occurs with getJSON method, this is a problem for me because I want to run some code instead the alert but it won't run in 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');
});