Home  >  Article  >  Web Front-end  >  jquery implements obtaining address through ip

jquery implements obtaining address through ip

韦小宝
韦小宝Original
2017-11-18 11:09:332249browse

A simple small application that uses jquery to obtain the address through the user's ip, providing free source code ~~

jquery implements obtaining address through ip

Code:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>PHP中文网</title>
	</head>
	<body>
		<p></p>
		<script src="http://www.jq22.com/jquery/jquery-2.1.1.js"></script>
			<script type="text/javascript">
        $.getScript(&#39;http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&#39;, function(_result) {
            if (remote_ip_info.ret == &#39;1&#39;) {
              $("p").text(&#39;国家:&#39; + remote_ip_info.country  +&#39;\n&#39;+&#39;省:&#39; + remote_ip_info.province +&#39;\n&#39;+&#39;市:&#39; + remote_ip_info.city +&#39;\n&#39;+&#39;区:&#39; + remote_ip_info.district + +&#39;\n&#39;+&#39;ISP:&#39; + remote_ip_info.isp +&#39;\n&#39;+&#39;类型:&#39; + remote_ip_info.type + +&#39;\n&#39;+&#39;其他:&#39; + remote_ip_info.desc);
            } else {
                alert(&#39;没有找到匹配的IP地址信息!&#39;)
            }
        });
</script>
</script>
	</body>
</html>

Get it for free and study it! More good source codes are available on PHP Chinese website, follow us and give you a good look~

Related recommendations:

css, jquery to realize 3D three-dimensional rotation

jquery to realize gesture unlocking source code

Native js can be implemented Mobile prompt div box source code

The above is the detailed content of jquery implements obtaining address through ip. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn