js传递数组
dd.do?titles[]=col1&titles[]=col2&titles[]=col3
var param = {titles:['col1','col2','col3']}; $.ajax({url:"dd.php" , type:"post" , data:param , async:false , dataType:"json"/**这个类型很重要 */ ,cache:false , error:function (data) { rtnObj = data.responseText; } , beforeSend:function (XMLHttpRequest) { //ajaxStart(); } , complete:function (XMLHttpRequest, textStatus) { //ajaxComplete(); } , success:function (data) { rtnObj = data; } });
springMVC接收数组参数
RequestMapping(value="/save", method = RequestMethod.POST) @ResponseBody public String save(@RequestParam(value = "titles[]") String[] titles){ System.out.println(titles); return null; }