Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
Created May 5, 2016 09:09
Show Gist options
  • Save d1i1m1o1n/608091bb8e838780a59dd8c160a58856 to your computer and use it in GitHub Desktop.
Save d1i1m1o1n/608091bb8e838780a59dd8c160a58856 to your computer and use it in GitHub Desktop.
Client side IP geolocation using http://ipinfo.io
<h3>Client side IP geolocation using <a href="http://ipinfo.io">ipinfo.io</a></h3>
<hr/>
<div id="ip"></div>
<div id="address"></div>
<hr/>Full response: <pre id="details"></pre>
$.get("http://ipinfo.io", function (response) {
$("#ip").html("IP: " + response.ip);
$("#address").html("Location: " + response.city + ", " + response.region);
$("#details").html(JSON.stringify(response, null, 4));
}, "jsonp");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment