2

我有一个可以正常工作的服务器端分页启用数据表。以下是我初始化的表,它提取 json 数据并呈现:

function initTestTable(){
    myTable = $('#testTable').dataTable({
   "processing": true,
   "serverSide": true,
   "ajax": {
       "url": "testTableData.html",
       "type": "GET",
   },
   "columnDefs": [ {
       "targets": 0,
       "data": "code",
       "render": function ( data, type, full ) {
           return '<a href="'+data+'">'+data+'</a>';
         }
     },
     {
       "targets": 1,
       "data": "description",
       "render": function ( data, type, row, meta ) {
           return data;
       }
     }]
 });

}

甚至在 ajax 重新加载之后的 ajax 工作正常:

myTable.api().ajax.reload(); //reloads ajax with very previous ajaxed URL

问题是当我想使用以下 load() 函数重新加载不同的 URL 时。实际上,它冻结了“处理中...”消息,而不将数据呈现在表上。反应好像没问题。

myTable.api().ajax.url('getNextData.html').load(); //reloads ajax with specified URL

我不知道出了什么问题,因为开发人员工具控制台中显示了错误。请建议。

4

0 回答 0