异步json发送put或者delete
时间:2019-11-30 16:56:46
收藏:0
阅读:96
第一种 put请求或者delete请求 直接写发送的情况
//批量删除 function batchDel() { var ids = []; $("#list-table").find("input:checked").each(function(){ var id =$(this).val(); ids.push(id); }); // alert(ids); $.ajax({ type:"DELETE", url:"pro/del", // data:{"ids":ids ,"_method":"delete"},
//将json对象转换为字符串输出, data:JSON.stringify({"ids":ids}),
//发送内容的格式为json字符串 contentType:"application/json", success:function (msg) { window.location.href="project-base.jsp" } }) }
然后在contrller层的方法参数上 加一个@RequestBody 注解 表名用来接收json数据 。
原文:https://www.cnblogs.com/ych961107/p/11962516.html
评论(0)