<!DOCTYPE html>
<html lang=
"en"
>
<head>
<meta charset=
"UTF-8"
/>
<title>Document</title>
</head>
<body>
<script src=
"https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"
></script>
<script type=
"text/javascript"
>
console.dir(Promise);
let data1;
$.ajax({
type:
"post"
,
url:
"http://jspang.com/DemoApi/typeGoods.php"
,
dataType:
"json"
,
success:
function
(data) {
console.log(data[0][0].price);
data1=data[0][0].price;
},
error:
function
() {
console.log(
"亲,出错了"
);
}
});
$.ajax({
type:
"get"
,
url:
"https://gsp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?cb=callback&wd="
+data1+
"&sc=hao123&_=1506355261424"
,
dataType:
"jsonp"
,
jsonp:
"cd"
,
jsonpCallback:
"callback"
,
success:
function
(data) {
console.log(data);
},
error:
function
() {
console.log(
"亲,出错了1"
);
}
});
$.ajax({
type:
"get"
,
url:
"https://gsp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?cb=callback1&wd="
+data1+
"&sc=hao123&_=1506355261424"
,
dataType:
"jsonp"
,
jsonp:
"cd"
,
jsonpCallback:
"callback1"
,
success:
function
(data) {
console.log(data);
},
error:
function
() {
console.log(
"亲,出错了0"
);
}
});
</script>
</body>
</html>