javascript - HTML5 get geolocation function -


i'm trying write function returns geolocation using html5. function never returns. how come?

function getcurlocation() {     navigator.geolocation.getcurrentposition(function(position) {           return [position.coords.latitude, position.coords.longitude];     }); } 

navigator.geolocation.getcurrentposition asynchronous call. ajax, can't return it's value synchronously rest of code. can't know when complete or if complete. work relies on response (position in case) of ajax call must done in ajax callback.


Comments

Popular posts from this blog

c# - Farseer ContactListener is not working -

Automatically create pages in phpfox -

database - one php page with different contents and urls -