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