Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Google Maps Geo giving JSONP error Unexpected token : or invalid label
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
for gmaps  
View profile  
 More options Apr 25 2012, 2:24 am
From: for gmaps <fayaz.m...@gmail.com>
Date: Tue, 24 Apr 2012 23:24:13 -0700 (PDT)
Local: Wed, Apr 25 2012 2:24 am
Subject: Google Maps Geo giving JSONP error Unexpected token : or invalid label
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...

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&_=1335 293866469
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Geary  
View profile  
 More options Apr 25 2012, 12:46 pm
From: Michael Geary <m...@mg.to>
Date: Wed, 25 Apr 2012 09:46:24 -0700
Local: Wed, Apr 25 2012 12:46 pm
Subject: Re: [Google Maps API v2] Google Maps Geo giving JSONP error Unexpected token : or invalid label

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rymalia  
View profile  
 More options Apr 27 2012, 6:59 pm
From: rymalia <ryanma...@gmail.com>
Date: Fri, 27 Apr 2012 15:59:43 -0700 (PDT)
Local: Fri, Apr 27 2012 6:59 pm
Subject: Re: Google Maps Geo giving JSONP error Unexpected token : or invalid label
I'm getting the same error, it worked fine until a few weeks ago.
Something must have changed on the Google side. It's their old API
version though, says it's deprecated since 2010 I think, not sure why
my developer used that version and not the new one V3. Ugh!

On Apr 24, 11:24 pm, for gmaps <fayaz.m...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Leach  
View profile  
 More options Apr 28 2012, 3:37 pm
From: Andrew Leach <andrew.leac...@gmail.com>
Date: Sat, 28 Apr 2012 20:37:56 +0100
Local: Sat, Apr 28 2012 3:37 pm
Subject: Re: [Google Maps API v2] Re: Google Maps Geo giving JSONP error Unexpected token : or invalid label
On 27 April 2012 23:59, rymalia <ryanma...@gmail.com> wrote:

> I'm getting the same error, it worked fine until a few weeks ago.
> Something must have changed on the Google side. It's their old API
> version though, says it's deprecated since 2010 I think, not sure why
> my developer used that version and not the new one V3. Ugh!

See this thread from 2009:
http://groups.google.com/group/google-maps-api/browse_thread/thread/3...

JSONP has **never** been documented or authorised.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Geary  
View profile  
 More options Apr 28 2012, 9:21 pm
From: Michael Geary <m...@mg.to>
Date: Sat, 28 Apr 2012 18:21:21 -0700
Local: Sat, Apr 28 2012 9:21 pm
Subject: Re: [Google Maps API v2] Re: Google Maps Geo giving JSONP error Unexpected token : or invalid label

Same problem as the OP. You're using an undocumented and unsupported URL.
Just change your code to use the documented google.maps.Geocoder methods
and it will work fine (subject to other conditions such as rate limits of
course):

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven Vance  
View profile  
 More options Nov 13 2012, 1:19 pm
From: Steven Vance <jamesbon...@gmail.com>
Date: Tue, 13 Nov 2012 10:19:52 -0800 (PST)
Local: Tues, Nov 13 2012 1:19 pm
Subject: Re: [Google Maps API v2] Re: Google Maps Geo giving JSONP error Unexpected token : or invalid label

It looks like the OP is calling the Google Geocoding API, not the
JavaScript Maps API. The JSON support is documented here:
https://developers.google.com/maps/documentation/geocoding/#JSON


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »