.html
<script>
http("top/playlist/?cat=华语").then(res=>{
let id=res.playlists[0].id;
return id;
}).then(res=>{
let id=res;
http(`playlist/detail?id=${id}`).then(res=>{
var {name,id}=res.playlist.tracks[0]
console.log(id);
})
})
</script>
index.js
function http(url){
return new Promise((resolve,reject)=>{
$.ajax({
url:`http://192.168.4.18:3000/${url}`,
type:"get",
success:res=>{
resolve(res)
},
error:err=>{
reject(err)
}
})
})
}