How to get client ip address in javascript of jquery?

How to get client ip address in javascript of jquery?

In this post we will give you information about How to get client ip address in javascript of jquery?. Hear we will give you detail about How to get client ip address in javascript of jquery?And how to use it also give you demo for it if it is necessary.

Sometime you need to save visitor’s ip address using javascript or jquery.

jQuery handle JSONP so it’s very easy to get client ip address by passing url formatted with the callback=? parameter with $.getJSON request.

You can also use $.get request to get ip address with data type jsonp.

  1. <htmllang="en">
  2. <head>
  3. <title>How to get client ip address in javascript or jquery?</title>
  4. <scripttype="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
  5. </head>
  6. <body>
  7. <h1>Your Ip Address (jsonip.com) : </h1>
  8. <spanid="ip"></span>
  9. <h1>Your Ip Address (ipinfo.com) : </h1>
  10. <spanid="ip1"></span>
  11. <scripttype="text/javascript">
  12. $.getJSON("http:/https://onlinecode.org/jsonip.com?callback=?", function (response) {
  13. $("#ip").text(response.ip);
  14. });
  15. $.get("http://ipinfo.io", function(response) {
  16. $("#ip1").text(response.ip);
  17. }, "jsonp");
  18. </script>
  19. </body>
  20. </html>
<html lang="en">
<head>
    <title>How to get client ip address in javascript or jquery?</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
</head>
<body>

<h1>Your Ip Address (jsonip.com) : </h1>
<span id="ip"></span>


<h1>Your Ip Address (ipinfo.com) : </h1>
<span id="ip1"></span>

<script type="text/javascript">
  $.getJSON("http:/https://onlinecode.org/jsonip.com?callback=?", function (response) {
      $("#ip").text(response.ip);
  });

  $.get("http://ipinfo.io", function(response) {
      $("#ip1").text(response.ip);
  }, "jsonp");

</script>

</body>
</html>

Show Demo

Hope this code and post will helped you for implement How to get client ip address in javascript of jquery?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

3  +  5  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US