function islocal() {
$.ajax({
type: 'GET',
url: 'https://restapi.amap.com/v3/ip?key=48ea1c2fb9755702721d3dbefbf94b08',
dataType: 'json',
contentType: 'application/json',
success: function (res) {
console.log('address',res.province);
var rest = res.province;
if (rest.length == 0 || /台湾/g.test(rest) || /香港/g.test(rest) || /澳门/g.test(rest)) {
islocalWatch = false;
} else {
islocalWatch = true;
}
}
});
}
islocal();
获取当前省份
最新推荐文章于 2024-03-29 18:44:41 发布