You're not using the JavaScript Maps API V3 geocoding service. You're
calling an undocumented backend API directly - it's no surprise that it
stopped working.

Throw out your $.ajax call and use the documented methods as described on
the page you referenced and it will work fine.

https://developers.google.com/maps/documentation/javascript/geocoding

-Mike

On Tue, Apr 24, 2012 at 11:24 PM, for gmaps <[email protected]> wrote:

> We're trying to get information of a user based on the lat longitude.
>
> Our code has been working fine until a couple weeks ago when we
> started getting this error.
>
> Here is our code:
>
> var reverse_geo_url = "http://maps.google.com/maps/geo?q="; + lat + ","
> + lng + "&key=[key]&sensor=false"
> console.log("Calling " + reverse_geo_url);
> new $.ajax(reverse_geo_url, {
>    dataType: "jsonp",
>    timeout: 5000,
>    success: function (data) {
>         // yay
>    }
> });
> Problem is that we all of a sudden are getting
>
> Uncaught SyntaxError: Unexpected token :
> Here is an example response from Google's servers (when I go directly
> to the url)
>
> {
>  "name": "33.0024912,-88.4218782",
>  "Status": {
>    "code": 200,
>    "request": "geocode"
>  },
>  "Placemark": [ {
>    "id": "p1",
>    "address": "Paulette Rd, Macon, MS 39341, USA",
>    "AddressDetails": {
>   "Accuracy" : 6,
>   "Country" : {
>      "AdministrativeArea" : {
>         "AdministrativeAreaName" : "MS",
>         "Locality" : {
>            "LocalityName" : "Macon",
>            "PostalCode" : {
>               "PostalCodeNumber" : "39341"
>            },
>            "Thoroughfare" : {
>               "ThoroughfareName" : "Paulette Rd"
>            }
>         }
>      },
>      "CountryName" : "USA",
>      "CountryNameCode" : "US"
>   }
> },
>    "ExtendedData": {
>      "LatLonBox": {
>        "north": 32.9994289,
>        "south": 32.9891822,
>        "east": -88.4094885,
>        "west": -88.4393238
>      }
>    },
>    "Point": {
>      "coordinates": [ -88.4238788, 32.9952338, 0 ]
>    }
>  } ]
> }
>
> https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingResponses
>
> Accessing the Geocoding service is asynchronous, since the Google Maps
> API needs to make a call to an external server. For that reason, you
> need to pass a callback method to execute upon completion of the
> request. This callback method processes the result(s). Note that the
> geocoder may return more than one result.
>
> According to the documentation callback is supposed to be supported.
> JQuery adds that callback header so I don't get why Google isn't
> honoring it.
>
> *Edit: For reference, the url that my app tries to call is
> http://maps.google.com/maps/geo?q=33.8024912,-84.4218782&key=[my key
>
> here]&sensor=false&callback=jQuery16409036452900618315_1335293866369&_=1335293866469
> Is this something on Google's side? Or is something on our side?
> Again, this code used to work perfectly.
>
> Other posts that I've seen on StackOverFlow, people are saying that
> when this error shows up in means that the server doesn't support
> JSONP... What's confusing to me is that this used to work... Did
> google change their API?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to