jQuery獲取訪問者IP地址的方法(基于新浪API與QQ查詢接口)

字號:


    這篇文章主要介紹了jQuery獲取訪問者IP地址的方法,實(shí)例分析了jQuery基于新浪API與QQ查詢接口獲取來訪者IP的相關(guān)參數(shù)傳遞與數(shù)據(jù)處理技巧,需要的朋友可以參考下
    本文實(shí)例講述了jQuery獲取訪問者IP地址的方法。分享給大家供大家參考,具體如下:
    <script type="text/javascript" src="jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    //通過調(diào)用新浪IP地址庫接口查詢用戶當(dāng)前所在國家、省份、城市、運(yùn)營商信息
    $.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js',function(){
      $(".country").html(remote_ip_info.country);
      $(".province").html(remote_ip_info.province);
      $(".city").html(remote_ip_info.city);
      $(".isp").html(remote_ip_info.isp);
    });
    //通過調(diào)用QQIP地址庫接口查詢本機(jī)當(dāng)前的IP地址
    $.getScript('http://fw.qq.com/ipaddress',function(){
      $(".ip").html(IPData[0]); 
      });
    });
    </script>
    <div>國家:<span></span></div>
    <div>省份:<span></span></div>
    <div>城市:<span></span></div>
    <div>IP地址:<span></span></div>
    <div>運(yùn)營商:<span></span></div>
    希望本文所述對大家jQuery程序設(shè)計(jì)有所幫助。