pizza247
pizza247

Reputation: 3897

JavaScript callback in mobile Safari

Here is the code I have:

$.getJSON("http:\/\/tinygeocoder.com\/create-api.php?g=" + lat + "," + lng + "&callback=?", function(data) {
      alert(data);};

and it's working fine in Chrome and Safari... but fails in mobile Safari. Here is the error i'm getting:

http://tinygeocoder.com/create-api.php?g=39.67997936,-104.(removed for space)&callback=jsonp1302553994489
SyntaxError: Parse error

Anyone have any ideas?

Upvotes: 0

Views: 258

Answers (2)

Guffa
Guffa

Reputation: 700152

When I try to browse to that URL, I get this response back:

Bummer, we've had too many queries and one of our data sources has decided not to work. Please <a href="mailto:[email protected]">let us know</a>.

As this is not JSON, it causes your parsing error.

Upvotes: 3

Eric Conner
Eric Conner

Reputation: 10752

Looks like you might have some URL sensitive characters in your lat and lng variables. You could try using encodeURIComponent() on those.

Upvotes: 0

Related Questions