使用jq获取ip 归属地等
$(function () {
$.ajax({
url: 'https://whois.pconline.com.cn/ipJson.jsp?json=true',
type: 'get',
dataType: 'jsonp',
success: function (res) {
console.log(res)
// console.log(res.address)
// console.log(res.content.address)
// console.log(res.content.address_detail.adcode)
// console.log(res.content.address_detail.city)
// console.log(res.content.address_detail.city_code)
// console.log(res.content.address_detail.district)
// console.log(res.content.address_detail.province)
// console.log(res.content.address_detail.street)
// console.log(res.content.address_detail.street_number) }
});
});
// 方法二
$.get("https://whois.pconline.com.cn/ipJson.jsp?json=true",function(data){ console.log(data); });