Google Maps API Geocode gives error "Invalid label" in Firefox

Posted by Bennystijn on Stack Overflow See other posts from Stack Overflow or by Bennystijn
Published on 2010-04-21T17:18:55Z Indexed on 2010/04/21 21:43 UTC
Read the original article Hit count: 523

Filed under:
|
|
|
|

Today I struggled with the following:

$.ajax({url:'http://maps.google.com/maps/api/geocode/jsonaddress=Karachi&sensor=false&output=json&callback=?',
        dataType: 'json',
        success: function(data){
         //eval("("+data+")");
         alert(data);
        }
});

Firefox gives the error "Invalid Label" and Chrome "Uncaught SyntaxError: Unexpected token :". I found a lot of posts about this, and I tried all kinds of things like eval(), but also:

$.getJSON('http://maps.google.com/maps/api/geocode/jsonaddress=Karachi&sensor=false&output=json&callback=?',
 function(data){
  //eval("("+data+")");
  alert(data);
 }
);

Same result. Also, other json data works fine, for instance flickr ("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?). So it has something to do with the Google Maps API output i guess..

Thanks in advance.

© Stack Overflow or respective owner

Related posts about google

Related posts about maps