jquery - Issues with $.getJSON in IE8 -
i'm unfortunately required support ie8 , i'm unable simple $.getjson request work properly.
here code:
url = "http://www.somejson.com/data.json"; $.getjson(url, function(data) {     var funds = []; var benchmarks = [];     funds.push(data.funds); benchmarks.push(data.benchmarks);      $.each( data.funds, function(key, value) {          var ticker = key;          // monthly:         var appendtodaily = function(ticker) {             $.each($("#"+ticker), function(key, value, index) {                 $(this).children("td").filter(":nth-child(1)").html( '<td>'+funds[0][ticker].name+'</td>' );                 $(this).children("td").filter(":nth-child(2)").html( '<td>'+ticker+'</td>' );                 $(this).children("td").filter(":nth-child(3)").html( '<td>'+funds[0][ticker].fund.inception_date+'</td>' );             });         };          appendtodaily(ticker);      });  });   this code works fine in chrome, firefox, , ie9+.
i've tried few things fix no success:
- i've tried use 
$.ajaxmethod instead. - set header json data to: 
response.setcontenttype("text/javascript; charset=utf-8");suggested here. - added snippet before 
$.getjson:$.ajaxsetup({ cache: false });reset true before terminating call suggested here. - i've explicitly included 
json2.jsin case. - reverted jquery 
1.11.0.min.jsin case. 
when attempt run code, several errors saying "fund" , "funds" undefined. notice absolutely nothing inside $.getjson callback function fires; alert() ignored.
i'm kind of @ wit's end here suggestions appreciated! in advance.
you might not getting successful response if data undefined. try using following snippet see if can isolate error.
$.getjson('http://...')      .done(function(response) { console.log('complete'); })      .fail(function(error) { console.log('error'); });   if console outputs 'error' can work there. can either step-debug or output error result console.
Comments
Post a Comment