0 votes
in javascript by
hello all, i want to show Client side IP geolocation on my html.

please help if anyone know.

1 Answer

0 votes
by (340 points)

hi, this 100% working code if still need help, plz revert.

 
 

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<hr/>
<div id="ip"></div>
<div id="address"></div>
<!--<hr/>Full response: <pre id="details"></pre>-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$.get("http://ipinfo.io", function (response) {
    $("#ip").html("IP: " + response.ip);
    $("#address").html("Location: " + response.city + ", " + response.postal);
    $("#details").html(JSON.stringify(response, null, 4));
}, "jsonp");
</script>

</body>
</html>

Welcome to My QtoA, where you can ask questions and receive answers from other members of the community.
...