$ .getJson does not work in IE

Ok, for some reason my getJson is not working. I collect stock information and it works in all major browsers except IE.

I created JSfiddle here: http://jsfiddle.net/qZhSk/

If someone can help me understand what I'm doing wrong, he will be SUPER helpful.

thanks!

EDIT

I found a solution myself. The problem was in my url request. If anyone else has this problem, here is the answer:

var url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20WHERE%20symbol%3D'NPO'&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"; $.getJSON(url + "&format=json&callback=?", function(data) { var items = []; $.each(data.query.results.quote, function(key, val) { items.push('<li id="' + key + '">' + val + '</li>'); }); $('<ul/>', { 'class': 'my-new-list', html: items.join('') }).appendTo('body'); )}; 
+7
source share
3 answers

Technically, I think you are violating the same origin policy on this one. By definition, you cannot make JSON from a domain other than your own ... and getting data from Yahoo is definitely different from jsFiddle server. There is a similar problem described here. The CORS exceptions they list are IE prior to version 10, which perfectly explains the problem.

The problem can be solved with "?" in the callback handler. See the article on this stack for more details .

+8
source

Since his old post, this answer may be useful to other searchers.

There may be two reasons why getJson does not work in IE.

1. Or Jsonp requests that are resolved by adding

  &callback=? or &callback=? 

2. Install ajax capture.

 $.ajaxSetup({ cache: false }); 

If you have problems, this may be due to the use of a cross-platform API.

+1
source

All Articles