我有一个数据表,我在服务器端模式下使用它来通过 AJAX 检索数据。从表面上看,一切似乎都是正确的,但是,当我加载页面时,显示的是“未找到匹配记录”,而不是显示数据。特殊的部分是它说它正在显示记录“显示 2 个条目的记录 1 到 2”。
表格HTML和JS如下:
<div class="container">
<script type="text/javascript">
$(document).ready(function() {
$("#freebieslist").dataTable({
"bServerSide": true,
"sAjaxSource": "/config/getadvertisers",
"bPaginate": true,
"bProcessing": true,
"bFilter" : true,
"sPaginationType" : "bootstrap",
"sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>"
});
$.extend( $.fn.dataTableExt.oStdClasses, {
"sWrapper": "dataTables_wrapper form-inline"
} );
});
</script>
<div class="row"><h1 class="pull-left">Advertisers</h1><div class="pull-right" style="margin-top:15px;"><a href="/config/addadvertiser" class="btn btn-primary">Add New</a> <a href="/config/delete" class="btn btn-danger">Delete</a></div> </div>
<div class="row">
<div class="span12">
<table id="freebieslist" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th class="span1"> </th><th>Advertiser</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div> </div>
正在加载的 JSON 是这样的:
{
"sEcho": "1",
"iTotalRecords": "2",
"iTotalDisplayRecords": "2",
"aaData": [
[
"2",
"Test2"
],
[
"1",
"Tester"
]
]
}
如何解决这个问题,以便它实际显示返回的行?