js获取客户端外网ip的简单实例

码如下:

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

你可能感兴趣的:(function,document,客户端)