Dim lat,lon,tlat,tlon
navigator.geolocation.getCurrentPosition(handler)
tlat = lat
tlon = lon
Calculate(tdate,tlat,tlon)
Function handler(location)
lon = location.coords.longitude
lat = location.coords.latitude
End Function
I am not able to get lat lon here . “print lat & lon” inside function handler works . But I want lat and lon for my Calculate function .
navigator.geolocation.getCurrentPosition(handler) happens asynchronously: the call to the function gets made. Execution of your code continues while the function is processing.
The statement
tlat = lat
is executed before the function returns, which is why it is undefined.