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:
- Create a server-side proxy to grab the data, then request it via AJAX.
- Use the Google Maps API
精彩评论