Skip to content

Instantly share code, notes, and snippets.

@lstoll
Created May 7, 2010 17:28
Show Gist options
  • Save lstoll/393747 to your computer and use it in GitHub Desktop.
Save lstoll/393747 to your computer and use it in GitHub Desktop.
$.getJSON('http://whereami.lds.li/loc.json?callback=?', function(data) {
var locstr = '';
if (data.city == 'N/A') {
locstr = 'Not Available..';
}
else {
locstr = data.city + ', ' + data.state + ', ' + data.country + '.';
locstr = '<a href="http://maps.google.com/maps?q='+ locstr + '&z=6">' + locstr + '</a>';
}
$('.currentloc').text(locstr);
});
<strong>Current Location:</strong> <span class="currentloc">...</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment