使用getJSON的Google Maps V3地理编码查询 [英] Google Maps V3 Geocoding Lookup using getJSON

查看:106
本文介绍了使用getJSON的Google Maps V3地理编码查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似这里的问题:

I have a question similar to here:

结合使用jquery.getJson和Google的GeoCoding HTTP服务

除了我试图从客户端查找中不使用API​​密钥来检索地址的地理坐标之外.

with the exception that I'm trying to retrieve the geo-coordinates for an address without using the API key, from a client-side lookup.

使用此代码,一切似乎都能正常工作

Everything seems to work when using this code:

$.getJSON("http://maps.google.com/maps/api/geocode/json?address=202++3991+Henning+Dr+Burnaby+BC+V5C+6N5&sensor=false&callback=?",
  function(data, textStatus){
     console.log(data);
     console.log(textStatus);
});

但是,我收到了标签无效"的jQuery错误.

However, I'm getting an 'invalid label' jQuery error.

推荐答案

V3地理编码API不支持callback参数,因此您尝试进行的JSONP调用将无法正常工作.相反,您可以使用JavaScript API并使用地理编码服务或通过以下方式代理结果您的Web服务器(以解决跨站点问题).

The V3 geocoding API doesn't support the callback parameter, so the JSONP call you're trying to make won't work. Instead you could use the JavaScript API and use the Geocoding Service or proxy the results through your web server (to get around the cross-site issues).

这篇关于使用getJSON的Google Maps V3地理编码查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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