JavaScript 的動態陣列方法正確的作法如下:
var i = 0;
var aryRow = new Array();
$.each( row, function( key, value ) {
aryRow[i] = new Array();
aryRow[i]['key']=key;
aryRow[i]['value']=value;
i++;
});
錯誤的寫法:
var i = 0;
var aryRow = new Array();
$.each( row, function( key, value ) {
var aryRow[i] = new Array();
aryRow[i]['key']=key;
aryRow[i]['value']=value;
i++;
});
沒有留言:
張貼留言