How to get ip address in jquery?

By Hardik Savani | June 8, 2016 | | 30011 Viewer | Category : Javascript jQuery


you can get ip address in jquery using getJSON(). If you need to get ip address in your js file you can get easily. In this example you can see how to get ip address in jquery. So let's try with this...

Example

<html lang="en">

<head>

<title>Jquery - get ip address</title>

<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>

</head>

<body>


<h1>Your Ip Address : <span class="ip"></span></h1>


<script type="text/javascript">

$.getJSON("http://jsonip.com?callback=?", function (data) {

$(".ip").text(data.ip);

});

</script>


</body>

</html>




***Do you want me hire for your Project Work? Then Contact US.


We are Recommending you: