How to get ip address in jquery?

By Hardik Savani | June 8, 2016 | | 12265 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>










Please Subscribe Your Email Address, We Will Notify When Add New Post:


We are Recommending you: