后台返回的如下格式的数据:
{
"sEcho": 3,
"iTotalRecords": 57,
"iTotalDisplayRecords": 57,
"aaData": [
{
"DT_RowId": "row_7",
"DT_RowClass": "gradeA",
"0": "Gecko",
"1": "Firefox 1.0",
"2": "Win 98+ / OSX.2+",
"3": "1.7",
"4": "A"
},
{
"DT_RowId": "row_8",
"DT_RowClass": "gradeA",
"0": "Gecko",
"1": "Firefox 1.5",
"2": "Win 98+ / OSX.2+",
"3": "1.8",
"4": "A"
}
]
}怎么不能放到 前台的table里面 ,这是什么原因呢??
我按照文档上的 方法
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../jsonServlet",
"contentType":"application/json",
"sEcho": 3,
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );求指点
{
"sEcho": 3,
"iTotalRecords": 57,
"iTotalDisplayRecords": 57,
"aaData": [
{
"DT_RowId": "row_7",
"DT_RowClass": "gradeA",
"0": "Gecko",
"1": "Firefox 1.0",
"2": "Win 98+ / OSX.2+",
"3": "1.7",
"4": "A"
},
{
"DT_RowId": "row_8",
"DT_RowClass": "gradeA",
"0": "Gecko",
"1": "Firefox 1.5",
"2": "Win 98+ / OSX.2+",
"3": "1.8",
"4": "A"
}
]
}怎么不能放到 前台的table里面 ,这是什么原因呢??
我按照文档上的 方法
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../jsonServlet",
"contentType":"application/json",
"sEcho": 3,
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );求指点
You should set the json-value returned from server into the dataTable.