我以某种方式设法实现了它,不幸的是客户端数据表在刷新时被破坏了。通过销毁,dataTable 中的所有数据都在一个页面中。这是桌子。<table id="earnings_amendment_account" class="table table-bordered" style="table-layout: fixed; display: none"> <thead> <th></th> <th>Account Code</th> <th>Account Title</th> <th>Account Type</th> <th>Tools</th> </thead><tbody id="table-body"> <?php include 'tableBody.php';?> </tbody> </table>这是 tableBody.php<?php include 'backend/conn.php'; ?> <?php $params=array(); $sql = "SELECT accountcode,accounttype,accounttitle,accounttype,postedby,dateposted,approvedby,dateapproved FROM earningsamendmentaccount";$query = sqlsrv_query($conn, $sql, $params, array("Scrollable" => SQLSRV_CURSOR_KEYSET));if ($query === false ) { echo "Error (sqlsrv_query): ".print_r(sqlsrv_errors(), true); exit; } while($row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)){ echo " <tr data-key-1='".$row['postedby']."' data-key-2='".$row['dateposted']."' data-key-3='".$row['approvedby']."' data-key-4='".$row['dateapproved']."'> <td class='details-control'></td> <td>".$row['accountcode']."</td> <td>".$row['accounttitle']."</td> <td>".$row['accounttype']."</td> <td>有没有办法解决这个问题?
1 回答
![?](http://img1.sycdn.imooc.com/533e52b90001456f02000200-100-100.jpg)
慕森卡
TA贡献1806条经验 获得超8个赞
尝试使用您的数据表对象 var earnings_amendment_account_table = $('#earnings_amendment_account').DataTable({});
所以在你的jQuery/AJAX - (earnings_amendment_account.php)更改$("#earnings_amendment_account").DataTable().ajax.reload();
为earnings_amendment_account_table.ajax.reload();
添加回答
举报
0/150
提交
取消