How to Get IP Address in JQuery?

By Hardik Savani November 5, 2023 Category : Javascript jQuery

Hey Folks,

In this quick example, let's see get ip address in jquery. I explained simply about get client ip address in jquery. Here you will learn How to get ip address in jquery. you will learn get client machine ip address in jquery. follow the below example for js get ip address.

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>

I hope it can help you...

Tags :
Shares