jQuery.getJSON不能正常工作在IE8与gdata的JSON-C。为什么? [英] jQuery.getJSON not working properly in IE8 with gdata json-c. Why?

查看:128
本文介绍了jQuery.getJSON不能正常工作在IE8与gdata的JSON-C。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jQuery:

$.getJSON('http://gdata.youtube.com/feeds/api/videos/b2-5GSjZvW8?v=2&alt=jsonc', function(meta){alert(meta.data.title);});

Firefox和Chrome预期这两个工作,但IE浏览器不断触发错误功能(当使用 $。阿贾克斯),而不是成功。错误状态是0,这没有太大的帮助。

Firefox and Chrome both work as expected, but IE keeps triggering the error function (when using $.ajax) instead of success. The error status is "0" which doesn't help much.

我也试着使用 $ AJAX 缓存:。假无济于事

I've also tried using $.ajax with cache:false to no avail.

任何想法?

推荐答案

我不能告诉你,如果它在jQuery的或IE浏览器错误,但它看起来像XDomainRequest在IE中失败。该加入的网址:

I can't tell you if it's an error in jquery or IE, but it looks like the XDomainRequest fails in IE. Add this to the URL:

&callback=?

......这样的回应将被处理为JSONP。

...so the response will be handled as jsonp.

编辑:它看起来像微软的 XDOmainRequest 是不是在jQuery的实现,所以你不能运行使用IE浏览器(除JSONP)跨域,请在jQuery的

It looks like Microsoft's XDOmainRequest is not implemented in jQuery, so you can't run Cross-Domain-Requests in jQuery using IE(except jsonp)

这篇关于jQuery.getJSON不能正常工作在IE8与gdata的JSON-C。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆