我在ASP.NET VS2010和C#.NET中作为后端语言工作,我没有使用MVC。 我从服务器端加载数据时遇到问题。它显示正确的行数但没有数据。我的JSON响应是有效的Json字符串。
任何人都知道如何解决这个问题???????
这是我回复的字符串
{"sEcho": 1,"iTotalRecords": 2,"iTotalDisplayRecords": 2,"aaData": [{"Name":"IT","DescEn":"Information Technology","DescAr":"testing","CreatedOn":"18-03-2013","CreatedBy":"1"},{"Name":"HR","DescEn":"Human Resource","DescAr":"testing","CreatedOn":"18-03-2013","CreatedBy":"1"}]}
这是html
<table id='example' class="datatable">
<thead>
<tr>
<th>
Name
</th>
<th>
DescEn
</th>
<th>
DescAr
</th>
<th>
CreatedOn
</th>
<th>
CreatedBy
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
这是一个JS脚本
$(document).ready(function () {
var oTable = $('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"bDestroy": true,
"sPaginationType": "full_numbers",
"aaSorting": [[1, "desc"]],
"sAjaxSource": '<%= Page.ResolveClientUrl("Request/GroupPage.aspx") %>',
"aoColumns": [
{ "aaData": "Name" },
{ "aaData": "DescEn" },
{ "aaData": "DescAr" },
{ "aaData": "CreatedOn" },
{ "aaData": "CreatedBy" }
]
});
});
任何人都知道如何解决这个问题????????
答案 0 :(得分:1)
请至少在谷歌搜索解决方案。我想我不必在这里重复相同的答案。
JSON format error even though echo matches with DataTables