Google Maps LatLng returning (NaN,NaN)
I am obtaining my clients geographic coordinates with the following code:
loc={}
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(function(position){
loc.lat = position.coords.latitude;
loc.lng = position.coords.longitude;
});
}
I am then trying to turn this into a google map coordinate with the
following code
var clientLocation = new google.maps.LatLng(loc.lat, loc.lng);
This however is returning
(NaN,NaN)
Can anyone suggest what I may be doing wrong?
No comments:
Post a Comment