jQuery的Ajax写法
1、什么是Ajax :是与服务器交换数据的技术,在不重载全部页面的情况下,实现了对部分网页的更新
2、jQuery的Ajax写法
<script src=".............."></script>
(1)$.ajax({
//请求的地址
url:“。。。。。。。。。。。。。。。。。。。。”,
//请求的方式
type:"get" 或者“post”
//请求的参数
data:{},
//在成功发送请求之前
//成功回调
success:function(res){
console.log(res)
},
//回调失败
error{
console.log(404)
}
//成功发送请求后
})
(2) $.post(\'https://showme.myhope365.com/api/shop/shopGoods/open/hot/list\', { pageSize: 1, pageNum: 3 }, function (res) { console.log(res) })
(3) $.get(\'https://showme.myhope365.com/api/shop/shopGoods/open/banner/list\',{},function(res){console.log(res)})
</script>
(4) 元素.load() 可以将本地的内容加入到html中