Document
$(function(){
// jq入口函数
function axios(config){
const promise = new Promise((resolve) => {
$.ajax({
url:config.url,
success(res){
resolve({res})
}
})
})
return promise
}
axios({
url:'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata'
}).then(res => {
console.log(res);
const promise = axios({url:'https://api-hmugo-web.itheima.net/api/public/v1/home/catitems'})
return promise
}).then(res => {
// 等于上一个then中 发送的请求的返回值
console.log(res);
})
})
一键复制
编辑
Web IDE
原始数据
按行查看
历史