'jQuery.getJSON' not working in Internet Explorer 8

混江龙づ霸主 提交于 2019-12-03 21:16:49
leomeurer

Try this to handle the error:

jQuery.getJSON("https://graph.facebook.com/me/friends?access_token=" + aToken, 
    function(data) {
        alert(data);
    }
)
.error(function(jqXHR, textStatus, errorThrown) { alert(errorThrown); });

And try this hack in your code (as per comment below)

jQuery.support.cors = true;
Esailija

Internet Explorer 8 doesn't support CORS in the XMLHttpRequest object which jQuery is using. Internet Explorer 8 uses XDomainRequest object which jQuery doesn't support by default.

I totally solved this problem using Jason Moon script, here

https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest/blob/master/jQuery.XDomainRequest.js

hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!