开发者

Using Google Geolocation JSON

I'm trying to use Google Reverse Geocoding, which takes some coordenates and returns a JSON structure with some addresses. My javascript code is like this:

$.getJSON("h开发者_开发知识库ttp://maps.google.com/maps/api/geocode/json?", 
           { latlng: myDevice.Lat + "," + myDevice.Lon,
             sensor: true},
             function (data) {
               ...
           }
         )

However, when debugging with firebug, when it gets in the function, it turns out that data is null. Could someone give me any advice? Thank you!


You are likely bumping up against the Same-Origin Policy. You have two choices:

  1. Create a server-side proxy to grab the data, then request it via AJAX.
  2. Use the Google Maps API
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜