ajax传数组到后台,后台springmvc接收数组参数
var ids= new Array(); $("input[class='detailCheck']:checked").each(function(i,k){ var itemId=$(this).attr("itemId"); ids[i]=itemId; }); $.ajax({ url : ctx + "/test/setNoProcess.do", type : "get", data :{ids:ids}, success : function(data) { if ($.trim(data)=="success") { showTip("处理成功!"); }else{ showTip("处理失败!"); } } }); 后台springmvc 接收: @RequestMapping("/test/setNoProcess") @ResponseBody public String setNoProcess(@RequestParam(value = "ids[]") Integer[] ids){ List<Integer> list= Arrays.asList(ids); try{ decDeliverOrderService.getMapper().statusBatchUpdateToInit(list); }catch(Exception e){ log.error(e); return "error"; } return "success"; }