Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function success(position) {
// variable to store the coordinates
var location = position.coords.latitude + ',' + position.coords.longitude;
// select the span with id status
var s = $('#status');
// update the status message
s.html('found you!');
// Google Maps image using location
$('#wrapper').append('<img src="'+ location +
'&zoom=17&markers=size:medium|color:red|'+ location +
'&path=color:0x0000FF80|weight:2|'+ location +
'&size=480x360&sensor=false" />');
function error(msg) {
// select the span with id status
var s = $('#status');
// set the error message
s.html(typeof msg == 'string' ? msg : "failed");
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success, error);
} else {
error('not supported');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.