-1

所以我有以下代码有效:

var a = $("#sample_1").dataTable().fnAddData( [
     domEle['AGENCY_NAME'],
     domEle['ADVERTISER_NAME'],
     domEle['CAMPAIGN_NAME'],
     domEle['STRATEGY_NAME'],
     domEle['IMPRESSIONS'],
     domEle['CLICKS'],
     domEle['PC_CONVERSIONS'],
     domEle['PV_CONVERSIONS'],
     domEle['ADJ_PV_CONVERSIONS'],
     domEle['eCPM'],
     domEle['eCPA'],
     domEle['eCPC'],
     domEle['MEDIA_COST'],
     domEle['TOTAL_SPEND'],
]);

但是,我想按 AJAX 中返回的顺序显示列,所以我想将其更改为:

var a = $("#sample_1").dataTable().fnAddData( [
     $.each(data['columns_order'], function(key, value){

          domEle[data['columns_order'][key]['fieldy']],

      });
]);

但我不断收到以下错误"Uncaught SyntaxError: Unexpected token ) "

4

2 回答 2

0

我不确定,但我认为问题在于,最后,在 domEle[data['columns_order'][key]['fieldy']]

于 2013-03-01T13:53:47.280 回答
0
var a = $("#sample_1").dataTable().fnAddData({
     $.each(data['columns_order'], function(key, value){

      domEle[data['columns_order'][key]['fieldy']],

  });
});

复制粘贴上面的代码。您的代码中遗漏了一些括号

于 2013-03-01T13:54:53.543 回答