使用js获取外网ip
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
</head>
<script type="text/javascript">
jQuery(function($) {
var url = 'http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_=' + Math.random();
$.getJSON(url, function(data) {
alert(data.Ip); //弹出本地ip
});
});
</script>
<body>
</body>
</html>