Google Maps API Geocode gives error "Invalid label" in Firefox
- by Bennystijn
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.