Easy way to get an IP with JavaScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mikhus
    New Member
    • Feb 2012
    • 1

    Easy way to get an IP with JavaScript

    Easy way is this one. Combine http://smart-ip.net/geoip as JSON and jQuery:

    Code:
    $(document).ready( function() {
        $.getJSON( "http://smart-ip.net/geoip-json?callback=?",
            function(data){
                alert( data.host);
            }
        );
    });
Working...