Ajax两种请求方法
$.get()方法
$.get(url地址,回调函数) url地址?参数1=值&参数2=值
$.get(
"https://wkt.myhope365.com/weChat/applet/course/banner/list?number=5",
function (res) {
if (res.code == 0) {
// console.log(res);
res.data.forEach(function (item) {
console.log(item.imgUrlPc);
$(".box").append(`<img src="${item.imgUrlPc}" alt="">`);
});
}
}
);
$.post()方法
$.post(‘url地址’,请求参数,回调函数)
$.post(
"https://wkt.myhope365.com/weChat/applet/course/list/type",
{
type: "free",
pageNum: 1,
pageSize: 5,
},
function (res) {
console.log(res);
}
);