Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/470.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未使用用于jQuery的Datatables插件从Ajax调用中填充表_Javascript_Asp.net Mvc_Datatables - Fatal编程技术网

Javascript 未使用用于jQuery的Datatables插件从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</

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</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": ""
        },