ajax中传递数据可以使用
var checkedIds = new Array();
checkedIds.push(1);
checkedIds.push(2);
checkedIds.push(3);
$.ajax({
url:"bookBatchdelete.do",
data:{
checkedIds : checkedIds
},
type:"post",
dataType:"json",
traditional: true,
success:function(data){
}
})
后台接收可以使用:
@RequestMapping(value="xxx.do")
@ResponseBody
public String bookBatchDelete(HttpServletRequest request, String[] checkedIds){
}
注: 关键在于$.ajax({traditional: true,})设置,不然后台 String[] checkedIds接收不到值