js 传递Long数组给后端,,后端由@Request Long[] 接收
原生js
1 var xhr=new XMLHttpRequest(); 2 xhr.open("post","/museum/relic/delete"); 3 xhr.setRequestHeader("Content-type","application/json"); 4 xhr.send(JSON.stringify(deleteIds)); 5 xhr.onload=function (ev) { 6 var result=JSON.parse(xhr.responseText); 7 if(xhr.status==200){ 8 inputSelect(); 9 alert(result.result); 10 }else{ 11 } 12 }
jquery:https://www.liangzl.com/get-article-detail-21058.html
控制类方法的参数:
@PostMapping("/delete")
@ResponseBody
public Map<String,Object> deleteRelics(@RequestBody Long[] ids)