How to get client ip address in javascript of jquery?

How to get client ip address in javascript of jquery?

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. <html lang="en">
  2. <head>
  3. <title>How to get client ip address in javascript or jquery?</title>
  4. <script type="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. <span id="ip"></span>
  9. <h1>Your Ip Address (ipinfo.com) : </h1>
  10. <span id="ip1"></span>
  11. <script type="text/javascript">
  12. $.getJSON("http://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>

Phone: (+91) 8800417876
Noida, 201301
Attention Required! | Cloudflare

Sorry, you have been blocked

You are unable to access ressim.net

Why have I been blocked?

This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

What can I do to resolve this?

You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.