1

I know IE8 has been around for a while, and there are many questions about similar problems. Solution not found in other questions thought I did add some nice ideas from other questions. Like don't use $.getJSON in IE and always use cache: false in IE8 calls.

So question is why does this do not work in IE8? Did a for ... in loop but tried also to just alert inside the callback function and nothing. Feels like the ajax never gets fired...

jsFiddle: http://jsfiddle.net/cmx0yfy8/show

Only code in the page (besides loading jQuery in head):

$.ajax({
        url:"https://rawgit.com/umpirsky/country-list/master/country/cldr/en/country.json",
        cache: false,
        dataType: "json"
    }).done(function (data) {
         for (code in data){
        $('body').append('<div>' + code + '</div>'); 
    }; 
});
Sampson
  • 265,109
  • 74
  • 539
  • 565
Rikard
  • 7,485
  • 11
  • 55
  • 92

2 Answers2

1

What does the XHR console look like?

Try switching json to jsonp.

Reference: What are the differences between JSON and JSONP?

$.ajax({
    type: GET,
    url:"https://rawgit.com/umpirsky/country-list/master/country/cldr/en/country.json",
    cache: false,
    dataType: "jsonp",
    success: function(data){
        $.each(data, function(index, value) {
          $('body').append('<div>' + data.code + '</div>');
        });     
    }
});
Community
  • 1
  • 1
bill m
  • 111
  • 2
  • 13
0

I bet you are doing a cross-domain AJAX call which IE 8 does not support. Your best choice is to do it through an XDomainRequest.

http://msdn.microsoft.com/en-us/library/ie/dd573303%28v=vs.85%29.aspx

beautifulcoder
  • 10,832
  • 3
  • 19
  • 29