Javascript 未使用用于jQuery的Datatables插件从Ajax调用中填充表
ajax请求返回以下数据Javascript 未使用用于jQuery的Datatables插件从Ajax调用中填充表,javascript,asp.net-mvc,datatables,Javascript,Asp.net Mvc,Datatables,ajax请求返回以下数据 [{"ID":40,"Date":"\/Date(1407999600000)\/"},{"ID":39,"Date":"\/Date(1409036400000)\/"} HTML是: <table id="bookings-table" class="display"> <thead> <tr> <th>ID</th> <th>Date</
[{"ID":40,"Date":"\/Date(1407999600000)\/"},{"ID":39,"Date":"\/Date(1409036400000)\/"}
HTML是:
<table id="bookings-table" class="display">
<thead>
<tr>
<th>ID</th>
<th>Date</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Date</th>
</tr>
</tfoot>
</table>
如果你想知道为什么这个表没有被填充,只要看看它们,我相信你的json格式应该是这样的
{
"data": [
{
"ID": 40,
"Date": "\/Date(1407999600000)\/"
},
{
"ID": 39,
"Date": "\/Date(1409036400000)\/"
}
]
}
Javascript错误
$('#bookings-table').dataTable({
"ajax": {
"url": "/manager/Booking/GetBookings",
"dataSrc": ""
},
对其进行排序所有列现在都绑定
$('#bookings-table').dataTable({
"ajax": {
"url": "/manager/Booking/GetBookings",
"dataSrc": ""
},