Created
May 5, 2016 09:09
-
-
Save d1i1m1o1n/608091bb8e838780a59dd8c160a58856 to your computer and use it in GitHub Desktop.
Client side IP geolocation using http://ipinfo.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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