首页 > 代码库 > jq中查询IP地址

jq中查询IP地址

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title>Title</title>
</head>
<body>
您当前的IP地址为<p></p>
</body>
<script src="http://www.mamicode.com/jquery-1.11.3.js"></script>
<script>
var url = ‘http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_=‘ + Math.random();
$.getJSON(url, function(data) {
document.querySelector(‘p‘).innerHTML=data.Ip;
});
</script>
</html>

jq中查询IP地址