一、post请求传递数组参数值
var ids = new Array();
$.ajax({
type:"post",
url:"${request.getContextPath()}/*****",
dataType:"json",
data:{"idList":ids},
traditional:true,
success:function(data){
}
})
注意:traditional:true的使用;ids数组里是单个的值
后台接收的方式:
1、可以直接用request获取,request.getParameterValues('idList');
2、可以使用注解方式获取(使用springMVC),这种方式直接就可以获取到参数。
public String test(@RequestParam(value = "idList", required = false) Long[] idList){
...............
}
二、post请求传递数组对象
var tts = new Array();
$.ajax({
type:"post",
url:encodeURI("${request.getContextPath()}/*****"),
contentType:"application/json",
dataType:"json",
async:false,
data:JSON.stringify(tts),
success:function