js+springMVC 提交數組數據到後臺

1.ajax 代碼

var ids =new Array();
$.ajax({
    type: "POST",
    url: "/user/downReport",
    dataType: "html",
    traditional: true,
    data:{
        downReportArray:ids
    },
    async: true,
    success: function (data) {
        if(data.code==200){
            console.log("正在打包...")
        }
    }
});

 

2.後臺接收

    @RequestMapping(value = "/downReport", method = {RequestMethod.POST})
    @ResponseBody
    public Object downReport(@RequestParam(value = "downReportArray") Long[] downReportArray,HttpServletRequest request ) throws Exception {
       ...
    }
相關文章
相關標籤/搜索