显示ip地理位置信息

<!DOCTYPE html>
<html>
	<head>

	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
</script>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
	</head>
	<body>
	<center style="padding:400px 0">
ip:<input type="text" id="ip"/>
<input type="button" id="idbutton" value="�ύ"/>
</center>
	</body>
	<script type="text/javascript">
$(document).ready(function(){
	$("#idbutton").click(getAddress);
});
function getAddress(obj) {
	var ip=$("#ip").val();
	$.ajax(
			{
				url : 'http://whois.pconline.com.cn/ipJson.jsp',
				dataType : "script",
				data:{
					callback:'alertaddress',
					ip:ip
				},
				success : function() {
				}
			});
}
function alertaddress(json)
{
	alert(json.addr);
}
</script>
</html>


你可能感兴趣的:(显示ip地理位置信息)