var userLocationLat = "0,000000000";
var userLocationLon = "0,000000000";
function getLocation() {
if (navigator.geolocation)
navigator.geolocation.getCurrentPosition(showPosition, showError);
else
console.log("Geolocation is not supported by this browser.");
}
function showPosition(position) {
userLocationLat = position.coords.latitude;
userLocationLon = position.coords.longitude;
}
function showError(error) {
if (error.code == 1)
console.log("User denied the request for Geolocation.");
else if (err.code == 2)
console.log("Location information is unavailable.");
else if (err.code == 3)
console.log("The request to get user location timed out.");
else
console.log("An unknown error occurred.");
}
$(document).ready(function () {
getLocation();
});