<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
div>span{
display: block;
}
</style>
</head>
<body>
<form id="bbq">
<input type="text" name="tel"/>
<input type="button" value="submit" onclick="ssd();"/>
</form>
<div>
<span>1</span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
<script type="text/javascript">
function addds(){
// i=5;
// var ime= setInterval(function(){
// console.log(ssbbq.province);
// i--;
// if (i<=0) {
// clearInterval(ime);
// }
// },1000)
$("div>span").eq(0).html(ssbbq.areaVid);
$("div>span").eq(1).html(ssbbq.carrier);
$("div>span").eq(2).html(ssbbq.catName);
$("div>span").eq(3).html(ssbbq.ispVid);
$("div>span").eq(4).html(ssbbq.mts);
$("div>span").eq(5).html(ssbbq.province);
$("div>span").eq(6).html(ssbbq.telString);
console.log($("div>span").eq(0).html());
}
function bbssdd(){
var k =0;
var obj =ssbbq;//上面复制的data
$.each(obj, function(key, val) {
// alert(obj[key]);//可以输出成绩
console.log(key+":"+obj[key]);
// for(var i =0;i<obj.length;i++){
// console.log(obj);
$("div>span").eq(k).html(key+":"+obj[key]);
k++;
// }
// console.log();//可以输出姓名
});
}
function aabbcc(){
var k =0;
for(var i in ssbbq){
console.log(i+":"+ssbbq[i]);
console.log(k);
$("div>span").eq(k).html(i+":"+ssbbq[i]);
k++;
}
}
function ssd(){
var qimingzihaonan = $("#bbq").serialize();
// var data = "tel=13212180588";
console.log(qimingzihaonan);
// console.log(data);
$.ajax({
type:"get",
url:"https://tcc.taobao.com/cc/json/mobile_tel_segment.htm",
data:qimingzihaonan,
dataType: "jsonp",
jsonp: "callback",
async:true,
success:function(abc){
alert("csss");
// console.log(abc);
ssbbq = abc;
// addds();
bbssdd();
// aabbcc();
},
error:function(bbc){
alert("失败");
},
complete:function(XMLHttpRequest,textStatus){//成功失败都会调用的函数
alert(XMLHttpRequest.status);
}
});
}
</script>
</html>