当前位置:主页 > 网页前端 > JavaScript代码 >

js+springMVC 提交数组数据到后台的实例

时间:2021-03-27 09:30:10 | 栏目:JavaScript代码 | 点击:

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 {
     ...
  }

您可能感兴趣的文章:

相关文章