【问题标题】:Error while using Yahoo PlaceFinder API and jQuery in json format使用 json 格式的 Yahoo PlaceFinder API 和 jQuery 时出错
【发布时间】:2010-12-05 11:32:08
【问题描述】:

我正在我的一个项目中实现一些 Yahoo API。我在 jQuery 中使用 json 格式的 Yahoo GeoPlanet 并且非常顺利。但是我无法使用 json 格式的 jQuery 使用 Yahoo PlaceFinder API。

当我使用 $.getJSON 函数发出请求时,我收到以下消息:

XMLHttpRequest 无法加载 http://where.yahooapis.com/geocode?q=Vancouver&flags=J&count=10&lang=en&appid=MYKEY。 Access-Control-Allow-Origin 不允许来源“http://yrm”。

“http://yrm”是该项目的本地主机服务器名。

您将在下面找到我正在使用的代码:

var url = 'http://where.yahooapis.com/geocode?q=Vancouver&flags=J&count=10&lang=en&appid=' + yahooApiKey;

$.getJSON(url, function(data){
    console.dir(data);
});

console.dir 只在控制台打印 NULL。

知道我能做什么吗?

提前致谢!

【问题讨论】:

    标签: jquery json api yahoo


    【解决方案1】:

    添加

    &callback=?
    

    在url字符串的末尾

    【讨论】:

      猜你喜欢
      • 2012-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-09
      • 1970-01-01
      • 2013-12-28
      • 2012-06-08
      相关资源
      最近更新 更多