【发布时间】:2016-04-11 12:28:15
【问题描述】:
我有一个类似这样的 Json 数据
var data = '{"aaData":[{"rrno":"RR201600001","name":"Vikram","dob":"2016-04-11","gender":"Male","job_profile":"Buisness Associate","graduation":"B.Tech\/B.E.","total_exp":1,"status":"Accepted"},
{"rrno":"RR201600002","name":"Rahul","dob":"1992-10-13","gender":"Male","job_profile":"Buisness Associate","graduation":"B.Tech\/B.E.","total_exp":3,"status":"Rejected"}]}';
然后我像这样在 DataTable 中加载这些数据
var table = $('#dataTable1').DataTable();
table.ajax.url(url).load();
我的HTML是这样的
<table id="dataTable1" class="table table-bordered table-striped-col">
<thead>
<tr>
<th>Sourcing ID</th>
<th>Name</th>
<th>Dob</th>
<th>Gender</th>
<th>Job Profile</th>
<th>Basic / Graduation</th>
<th>Total Experience</th>
<th>Final Status</th>
</tr>
</thead>
</table>
但我收到一个弹出窗口作为警报提示
DataTables 警告:表 id=dataTable1 - 请求的未知参数 '0' 表示第 0 行
【问题讨论】:
-
你有一个字符串而不是一个对象。尝试删除开始和结束
's。
标签: jquery json datatables