Get IP address information using jQuery

In this post, you will learn how can you get all the details of an IP Address using jQuery. IP address is nothing but address of any computer located some where in the world. The jQuery code will return Country name, country code, city name, latitude and longitude details about the IP Address.

jqIpLocation is a jQuery Plugin that returns the location of an IP address in JSON format. You can get country, country code, city name, region name, latitude and longitude information about IP address location.

How to use it?

First, download the jqIpLocation.js file and put its reference along with jQuery library. And then add the Javascript that will returns you IP Location information in JSON format.

$.jqIpLocation({
  ip : '173.194.36.50',
  success: function(location) {             
     alert(location.countryName);
     alert(location.countryCode);
  }
});

Properties

The callback function return an object which hold various properties.

  • location.countryName : Country Name
  • location.countryCode : Country Code
  • location.cityName : City Name
  • location.regionName : Region Name
  • location.latitude : Latitude
  • location.longitude : Longitude

Note, the option "IP" is compulsory.

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...