weixin_33709609 2020-04-01 04:56 采纳率: 0%
浏览 7

Ajax请求传递数据?

I want to send an array in Ajax data request, but I the output that I get display items[..], How to get rid of it, so I can only fetch variable inside it?

enter image description here

var columnName = 'accountLedgerID';
var gridDataArray = $('#grid').data('kendoGrid').dataSource.data();

var items = {
  method: "updateSequence",
  this_propertyID: $('#thisPropertyID').val(),
  this_length: gridDataArray.length,
};
for ( var i=0; i < gridDataArray.length; i++ ) {    
  items["sequence_" + i] = i;
  items["accLedgerID_" + i] = gridDataArray[i][columnName]; 
}


$.ajax({
  url: "./getLedgerManagement.php",
  type: "POST",
  data: {
   //items - display a same result as below
   items:items
  },
  sucess: function(data){
    console.log('success')
  }
}); 

I expect it return data like this.

method: "updateSequence"
this_propertyID: "1"
this_length: 23
sequence_0: 0
accLedgerID_0: "LA26"
sequence_1: 1
accLedgerID_1: "LA8"
sequence_2: 2
accLedgerID_2: "LA29"
sequence_3: 3
accLedgerID_3: "LA2"
.....
  • 写回答

0条回答 默认 最新

    报告相同问题?