我有一個datatable.I試圖通過AJAX .The響應負載包含數據,但它沒有顯示數據found.My代碼如下數據表顯示零行即使得到的迴應
<table id="user_list_table">
<thead>
<tr>
<th>name</th>
<th>phone</th>
<th>email</th>
<th>address</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
給予我的JS包含
$(document).ready(function() {
var MY_AJAX_ACTION_URL = "/social/index.php?id=4&userform[action]=datatable&userform[controller]=User";
$('#user_list_table').dataTable({
"autoWidth": false,
"bPaginate": false,
"searching": false,
"ordering": true,
"oLanguage": {
"sZeroRecords": "No data Found",
"sProcessing": 'processing'
},
"bInfo": false,
"aoColumns": [
{'mData':'name','bSortable': true},
{'mData':'phone','bSortable': true},
{ 'mData':'email','bSortable': true },
{ 'mData':'address','bSortable': true}
],
"sAjaxDataProp": "",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource":MY_AJAX_ACTION_URL
});
});
我得到了以下回應
{"iTotalRecords":2,"iTotalDisplayRecords":{"data":[{"name":"xyz","phone":"678654454","email":"[email protected]","address":"ytruye"},{"name":"abc","phone":"678654454","email":"[email protected]","address":"ytruye"}]}}
您的表格是否顯示任何錯誤或「找不到數據」? –
這不是錯誤..我在表中包含零記錄時寫了消息。 –