简单的 JQuery getJSON 在 IE9 中不起作用
我正在尝试从 SimpleGeo 中读取类别列表...我的代码在 Chrome 和 FireFox 中运行良好,但在 IE 中失败。
$.getJSON("http://api.simplegeo.com/1.0/features/categories.json",function(json){
sgCategories = json;
});
看看其他几篇文章似乎提供了一些想法,但 API 似乎没有提供回调,而且我无法控制它们的格式...
https://stackoverflow.com/questions/6514457/getjson-or-ajax-requests-not-working-with-ie9 https:// /stackoverflow.com/questions/3517608/why-isnt-this-simple-bit-of-jquery-getjson-working-in-ie8
还有其他想法吗?
I am trying to read in the category list from SimpleGeo... my code works fine in Chrome and FireFox, but fails in IE.
$.getJSON("http://api.simplegeo.com/1.0/features/categories.json",function(json){
sgCategories = json;
});
Looking at a couple other posts seem to offer ideas but the API doesn't seem to offer a callback and I have no control of their format...
https://stackoverflow.com/questions/6514457/getjson-or-ajax-requests-not-working-with-ie9
https://stackoverflow.com/questions/3517608/why-isnt-this-simple-bit-of-jquery-getjson-working-in-ie8
Any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据您引用的其中一个链接,似乎可能有解决方法。
尝试将
&format=jsonp&callback=?
添加到 URL。我认为如果您添加回调参数,jQuery 可能会调用您指定的回调。
Based on one of those links you have cited, it appears there may be a work around.
Try adding
&format=jsonp&callback=?
to the URL.I think jQuery might call the callback you specify anyway if you add the callback parameter.
所以...事实证明,SimpleGeo 允许您通过其 javascript 客户端 API 获取类别列表。
棘手...
So... it turns out that SimpleGeo allows you to get the category list via their javascript client api.
Tricky...
jQuery.support.cors = true;
就是这样
jQuery.support.cors = true;
that's it