Jquery利用淘宝接口判断手机运营商和归属地
function findOperator(){
var url = "http://tcc.taobao.com/cc/json/mobile_tel_segment.htm";
var tel = $("#attribution").val();
var attribution=$("#showAttribution");
if(attribution.val()!=""){
attribution.val("");
}
$.ajax({
url:url,
data:{tel:tel},
dataType:'JSONP',
type:'GET',
success:function(res){
try{
if(res.province==undefined||res.catName==undefined){
alert("您输入的号码有误");
return;
}
attribution.text(res.province+" "+res.catName);
}catch(e){
logger.error(e);
}
}
});
}