利用淘宝API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h2>获取手机号归属地</h2>
<input type="text" id="num">
<button id="cityQuery">点击</button>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
$("#cityQuery").click(function () {
$.ajax({
type: 'get',
url: 'http://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=' + $("#num").val(),
dataType: 'script',
cache: false,
success: function (data) {
console.log(__GetZoneResult_.province)
}
});
});
</script>
</body>
</html>