Created
February 6, 2018 22:06
-
-
Save nickihastings/58d15a5790c0cc142479a76c9525758c to your computer and use it in GitHub Desktop.
Javascript function to get the latitude and longitude gelocation info from the browser.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
var latitude = ''; | |
var longitude = ''; | |
navigator.geolocation.getCurrentPosition(function(position) { | |
latitude = position.coords.latitude; | |
longitude = position.coords.longitude; | |
console.log('lat=' + latitude + ' long=' + longitude); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment