Skip to content

Instantly share code, notes, and snippets.

@brianherbert
Created February 10, 2011 21:40
Show Gist options
  • Save brianherbert/821402 to your computer and use it in GitHub Desktop.
Save brianherbert/821402 to your computer and use it in GitHub Desktop.
function geo_success(loc) {
$("#location_status").html('Location Found: '+loc.coords.latitude+','+loc.coords.longitude);
$("#lat").val(loc.coords.latitude);
$("#lon").val(loc.coords.longitude);
}
function geo_error() {
$("#location_status").html('Sorry, location search failed. Please try again.');
}
if (geo_position_js.init()) {
$("#location_status").html('Please wait while we locate your device.');
geo_position_js.getCurrentPosition(geo_success, geo_error);
}else{
$("#location_status").html('Sorry, your browser does not support geolocation.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment