chch8
chch8

Reputation: 11

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("http://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!

Upvotes: 1

Views: 1029

Answers (1)

circusbred
circusbred

Reputation: 1240

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

Upvotes: 2

Related Questions