无法使用jQuery从跨域JSON服务URL检索数据

无法使用jQuery从跨域JSON服务URL检索数据,jquery,ajax,json,jsonp,Jquery,Ajax,Json,Jsonp,可能重复: 变量url=”http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=pizza&zip=10504&results=2&output=json&callback=?"; getJSON(url、函数(数据){ 警报(数据); }); 变量url1=”http://services.odata.org/OData/OData.svc/Products?$format=js

可能重复:


变量url=”http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=pizza&zip=10504&results=2&output=json&callback=?";
getJSON(url、函数(数据){
警报(数据);
});
变量url1=”http://services.odata.org/OData/OData.svc/Products?$format=json&回调=?”;
getJSON(url1,函数(数据){
警报(数据);
});

通过运行上述代码,我可以看到第一个警报,但不能看到第二个警报。有人能告诉我这里的错误吗?我收到的错误是FF中的“无效标签”&预期;在IE8中,quest实际使用的是,这是当它在URL中检测到一个名为
回调的参数时所使用的

转到url,注意内容不包含字符串
xyzaxa
,这意味着从不从服务调用回调


要么您使用了错误的URL,要么odata doesent支持quest实际使用的JSONP

,这就是它在URL中检测到名为
回调
的参数时所做的

转到url,注意内容不包含字符串
xyzaxa
,这意味着从不从服务调用回调


要么您使用了错误的URL,要么odata doesent support JSONP

我已将上述代码放在我机器中的一个示例html文件中。我正在尝试学习JSONP。我已经将上面的代码放在我机器中的一个示例html文件中。我正在努力学习JSONP。
<script type="text/javascript">
    var url = "http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=pizza&zip=10504&results=2&output=json&callback=?";
    jQuery.getJSON(url, function (data) {
        alert(data);
    });
    var url1 = "http://services.odata.org/OData/OData.svc/Products?$format=json&callback=?";
    jQuery.getJSON(url1, function (data) {
        alert(data);
    });
</script>