0
我創建了mvc格式數據表。但是,加載scriopt時,它與表格數據不匹配,也不會綁定在我的表格行中。我的代碼如下。如何在jQuery數據表中設置對應值的值
$.ajax({
// my passing value
success: function (data) { // i get the data properly
$('#Table').dataTable().fnClearTable();
$.each(data, function (k, v) {
var ID= v.ID;
var name= v.name;
var batch= v.batch;
$('#Table').dataTable().fnAddData([
ID,
name,
batch
]);
});
}
});
我的表:
<table id="Table" width="100%">
<thead>
<tr>
<th>EMP_ID</th>
<th>EMP_name</th>
<th>EMP_batch</th>
</tr>
</thead>
<tbody></tbody>
</table>
數據表:http://www.datatables.net/
你確定'$。每次(數據,功能(K,V){'真的迭代中添加一些的console.log /警覺?確認它... – Daniel 2013-02-13 08:36:36