Skip to content

Instantly share code, notes, and snippets.

@mattspence
Created October 3, 2013 03:44
Show Gist options
  • Save mattspence/6804603 to your computer and use it in GitHub Desktop.
Save mattspence/6804603 to your computer and use it in GitHub Desktop.
script for geolocation and then jQuery post to a web2py controller
<script>
function getLocation() {
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(postLocation);
function postLocation(position)
{
jQuery.post( '{{=URL('set_location')}}',{lat: +position.coords.latitude, lng: +position.coords.longitude });
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment