$.getJSON, but you have that variable at the top of the JS panel that is trying to generate the URI using
long, and I'm guessing that they are not available, perhaps not in scope... Or just confused. You have the call to
navigator.geolocationup there at the top, but you have to synchronize with the return of the geolocation data before you can call the
$.getJSONfunction (I was confused because I see two different declaractions of
apiand calls to
navigator.geolocation.) Remember that the geolocation code is asynchronous!