首页 > 其他分享 >jQuery使用ajax

jQuery使用ajax

时间:2022-08-29 22:03:14浏览次数:59  
标签:jQuery function res ajax 服务器返回 使用 data id

1.导入jQuery的js库

 

2.jQuery发送单一的get请求

$.get(     url:'接口地址',     data:{         id:1,         name:2,         ......     }     function(res){         // res是服务器返回的数据     } )

 

 

 

3.jQuery发送单一的post请求 $.post(     url:'接口地址',     data:{         id:1,         name:'哈哈哈',         ......     }     function(res){         // res是服务器返回的数据     } )

 

 

 

4.jQuery发送符合Ajax请求 $.ajax({     type:'GET or POST',     url:'接口地址',     data:{         id:1,         name:'哈哈哈',         ......     }     success:function(res){         // res是服务器返回的数据     } })

 

 

标签:jQuery,function,res,ajax,服务器返回,使用,data,id
From: https://www.cnblogs.com/camboy/p/16637567.html

相关文章