jquery 向后台传数组 JAVA接收

时间:2022-08-26 10:06:05

JSP页面前端

var ids = $('input[type=checkbox][alt=one]:checked');
var data=new Array();
$(ids).each(function(index,value){
data.push($(this).val());
});
$.post('${path}/customer/del.html', {idCustomers:data.toString()}, function(json) {
if(json.success){
alert(json.msg);
} else {
alert(json.msg);
}
});

JAVA后台接受

使用SPRING MVC框架,参数名为:idCustomers

@RequestMapping(value="/del.html")
public @ResponseBody JSONResponse removeCustomerDetail(Long[] idCustomers){
JSONResponse json = new JSONResponse();

return json;
}