编辑:没有硬编码sEcho
编辑:
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<h3 class="panel-heading">Information</h3>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane active" id="dt_vendor">
<table id="dt_vendor">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
我有一个从.Net收到的JSON对象,JSON对象是按照指定的格式创建的。但我没有看到它加载数据并且我已经在Chrome控制台中检查过,我没有看到任何错误我已经有超过15,000条记录,我缺少什么,我知道它一定很傻
JSON对象:
<script>
$(document).ready(function () {
$("#dt_vendor").dataTable({
"oLanguage": {
"sZeroRecords": "No records to display",
"sSearch": "Search..."
},
'iDisplayLength': 10,
"lengthMenu": [ 5, 10, 20, 30, 50, 100 ],
"bSortClasses": false,
"bStateSave": false,
"bPaginate": true,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"bDestroy": true,
"sAjaxSource": "@Url.Action("GetAjaxData", "Vendor")",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bDeferRender": true,
"fnServerData": function (sSource, aoData, fnCallback) {
debugger;
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "GET",
"url": sSource,
"aadata": aoData,
"success":
function (msg)
{
var json = jQuery.parseJSON(msg.d);
fnCallback(json);
$("#dt_vendor").show();
}
});
}
});
});
</script>
答案 0 :(得分:0)
原始答案
以下是您调试的几点想法:
<强>解决方案强>
确保.NET代码的响应中包含的sEcho
的值与.NET代码请求中提供的sEcho
的值相同。