js获取手机号码归属地(省)

js获取手机号码归属地(省)

city.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="">

<head>

   <title>获取手机号码归属地</title>

   <meta http-equiv="content-type" content="text/html; charset=utf-8">

   <script src="js/jquery-1.11.1.min.js" type="text/javascript"></script>

   <script src="js/num.js" type="text/javascript"></script>

</head>

<body>

 <input type="text" id="num" />

 <button type="button" id="cityQuery">查询</button>

 <p id="city"></p>

</body>

</html>

num.js:

$(function(){
 $("#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) {
     $("#city").text(__GetZoneResult_.province);
    }
   }
  );
 });
});

猜你喜欢

转载自blog.csdn.net/AI_U20/article/details/88188867