Skip to content

Instantly share code, notes, and snippets.

@raykrueger
Created July 29, 2011 14:48
Show Gist options
  • Save raykrueger/1113961 to your computer and use it in GitHub Desktop.
Save raykrueger/1113961 to your computer and use it in GitHub Desktop.
if (!!navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
$.get('/locate?lat=' + lat + '&lng=' + lng, function(data){
$('#locations').html(data);
});
},
function(e) {
alert("Something bad happened, I cannot get your current location.");
}
);
} else {
alert("Sorry, your browser is inferior. IE?");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment