.then
<script>
var http01 = Promise.resolve(1001);
var http02 = Promise.resolve("detail");
http01.then(res=>{
console.log(res)
return res;
}).then(id=>{
/* 得到id值发送http请求 */
http02.then(res=>{
console.log("detail")
})
})
</script>
await
<script>
var http01 = Promise.resolve(1001);
var http02 = Promise.resolve("detail");
async function show(){
var id = await http01;
console.log(id);
/* 根据id去发送http请求 */
var detail = await http02;
console.log(detail)
}
show()
</script>