多个阵列数据通过ajax发送

时间:2013-07-03 09:38:05

标签: javascript jquery arrays json ajax

我有问题: 我的jquery代码是

var sverimas_array = [];
$('table[id=aktEditTable] tbody tr').each(function(){
  var data = [];
  $(this).find('td').each(function(col_key){
    var td_input = $(this).find('div input');
    if ( col_key != 8 ) { data[td_input.attr('name')] = td_input.val() }
  });
  sverimas_array.push(data);
});
console.log(sverimas_array);
$.ajax({
  url     :"_aktas_function.php",
  type    :'POST',
  dataType:'JSON',
  cache   :false,
  data    :{job :'insert',
          PHPSESSID :'<?php echo session_id();?>',
              data  :$("#aktForm_data").val(),
          sverimas  :sverimas_array,
            },
  error   : function(xhr, errorString, exception) { alert ('error');    },
  success : function(data){
              if (data[0].status == "ok"){
                alert(data[0].st);
              }
              else { alert ('error'); }
            }
});

在控制台中我看到sverimas_array如:

[Array[0], Array[0], each: function, eachSlice: function, all: function, any: function, collect: function…]
0: Array[0]
aktForm_bruto: "55"
aktForm_indexas: "1"
aktForm_neto: "47.50"
aktForm_pakuote_skaicius: "5"
aktForm_pakuote_svoris: "9.50"
aktForm_pastaba: ""
aktForm_tara_svoris: "1.5"
aktForm_tara_tipas: "poperine"
length: 0
__proto__: Array[0]
1: Array[0]
aktForm_bruto: "55"
aktForm_indexas: "2"
aktForm_neto: "47.50"
aktForm_pakuote_skaicius: "5"
aktForm_pakuote_svoris: "9.50"
aktForm_pastaba: ""
aktForm_tara_svoris: "1.5"
aktForm_tara_tipas: "poperine"
length: 0
__proto__: Array[0]
length: 2
__proto__: Array[0]

$_POST['sverimas']文件中的_aktas_function.php没有给我任何帮助。

0 个答案:

没有答案