jQuery獲取訪問者IP地址的方法(基于新浪API與QQ查詢接口)
本文實例講述了jQuery獲取訪問者IP地址的方法。分享給大家供大家參考,具體如下:
<script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ //通過調(diào)用新浪IP地址庫接口查詢用戶當前所在國家、省份、城市、運營商信息 $.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地址庫接口查詢本機當前的IP地址 $.getScript('http://fw.qq.com/ipaddress',function(){ $(".ip").html(IPData[0]); }); }); </script> <div>國家:<span class="country"></span></div> <div>省份:<span class="province"></span></div> <div>城市:<span class="city"></span></div> <div>IP地址:<span class="ip"></span></div> <div>運營商:<span class="isp"></span></div>
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jquery中Ajax用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴展技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動畫與特效用法總結(jié)》、《jquery選擇器用法總結(jié)》及《jQuery常用插件及用法總結(jié)》
希望本文所述對大家jQuery程序設(shè)計有所幫助。
相關(guān)文章
jQuery 更改checkbox的狀態(tài),無效的解決方法
下面小編就為大家?guī)硪黄猨Query 更改checkbox的狀態(tài),無效的解決方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-07-07jQuery+css實現(xiàn)炫目的動態(tài)塊漂移效果
這篇文章主要介紹了jQuery+css實現(xiàn)的動態(tài)塊漂移效果,涉及jQuery基于隨機數(shù)與時間函數(shù)動態(tài)操作頁面元素樣式的相關(guān)技巧,需要的朋友可以參考下2016-01-01jQuery EasyUI tree增加搜索功能的實現(xiàn)方法
擴展jQuery EasyUI tree搜索樹節(jié)點的方法,使其支持節(jié)點名稱的模糊匹配,將不匹配的節(jié)點隱藏。下面通過本文給大家分享jQuery EasyUI tree增加搜索功能,需要的朋友可以參考下2017-04-04