Jquery datatable集成错误?

我正在将jquery datatable整合到我的项目中。当调用服务时,一些如何跟随错误抛出错误

不能读取未定义的属性分类

这是代码

时间线

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script  src="js/jquery.dataTables.js"></script>
<body>

<script>

$(document).ready( function() {
  $('#example').dataTable( {
    "bProcessing": true,"bServerSide": true,"sAjaxSource": "URL","fnServerData": function ( sSource,aoData,fnCallback,oSettings ) {
    console.log(aoData);
      oSettings.jqXHR = $.ajax( {
        "dataType": 'json',"type": "POST","url": sSource,"data": aoData,"success": fnCallback
      } );
    }
  } );
} );

</script>

<div id="dvContent">
 <table cellpadding="0" cellspacing="0" border="0"  id="example">

 </table>
</div>

</body>

这是服务器的样品输出

{ “一些”: “YYY”
“开放”:空,
“节目”:1,
“多”:“必须”,
“意见”:000
}

解决方法

您的桌子需要一个THEAD部分和一个TBODY部分:
<table cellpadding="0" cellspacing="0" border="0"  id="example">
   <thead><tr><th>First Column</th><th>Second Column etc.</th></tr></thead>
   <tbody>
   </tbody>
</table>

BQB

注意:同样重要的是,由于dataTable需要您指定< tr>< / th>< / tr>< / th>< / th>指定的期望数据的列数,因此您的THEAD不为空

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...