Hi,
I’m creating a project for displaying a user’s location on a map and showing available restaurants near by
I am using, open external link with the following javascript to get the user’s location
function getLocation(callback) {
if (navigator.geolocation) {
var lat_lng = navigator.geolocation.getCurrentPosition(function(position){
var user_position = {};
user_position.lat = position.coords.latitude;
user_position.lng = position.coords.longitude;
callback(user_position);
});
} else {
alert("Geolocation is not supported by this browser.");
}
}
getLocation(function(lat_lng){
console.log(lat_lng);
});
Which works for getting the user’s lat long but I’m now stuck trying to work out how to get the lat long in order for me to add it to google maps parameter for returning their location
Any ideas/solutions would be greatly appreciated!