//创建一个测试数组
var boxIds = new Array();
boxIds.push(12182);
boxIds.push(12183);
boxIds.push(12184);
//向后台交互
$.ajax({
    url: "/xxx",
    type: "GET",
    data: {
        "boxIds": boxIds,
        "boxType": 0,
        "time": new Date().getTime()
    },
    success: function(data) {
        //do sth...
    }
});

后台收不到值。

解决办法: 
设置jQuery.ajax的tradional属性

 

 1 $.ajax({
 2     url: "/xxx",
 3     type: "GET",
 4     data: {
 5         "boxIds": boxIds,
 6         "boxType": 0,
 7         "time": new Date().getTime()
 8     },
 9     traditional: true,//这里设置为true
10     success: function(data) {
11         //do sth...
12     }
13 });

 

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
相关资源
相似解决方案