datatables java - 无效的json响应

时间:2014-11-05 19:13:49

标签: java json datatables

我正在尝试将数据表与java一起使用,并且在更改了json的格式之后,我仍然可以使数据表正常工作

我一直在阅读文档,我认为json是正确的,但数据表总是抱怨

错误:

DataTables warning: table id=example - Invalid JSON response ...

json数据:

{
    "recordsTotal":3,
    "recordsFiltered":3,
    "data":[
        {"id":"3385453","entityCode":"IVR","entityId":"189858","satusCode":"A","typeCode":"U1","locationCode":"B","entryDate":1193025600000},
        {"id":"54321000","entityCode":"IVR","entityId":"189858","satusCode":"A","typeCode":"O1","locationCode":"E","entryDate":1413317138380},
        {"id":"54321001","entityCode":"IVR","entityId":"189858","satusCode":"A","typeCode":"O1","locationCode":"E","entryDate":1413317138430}
    ]
}

的javascript:

$(document).ready(function() {
    $('#example').dataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": {
            "url": "api/documents/entity-id/189858/data-table",
            "dataType": "jsonp",
            "columns": [
                 { "data": "id" },
                 { "data": "entityCode" },
                 { "data": "entityId" },
                 { "data": "statusCode" },
                 { "data": "typeCode" },
                 { "data": "locationCode" },
                 { "data": "entryDate" }
             ]
        }
    });
});

HTML:

<table id="example" class="display">
    <thead>
        <tr>
            <th>A</th>
            <th>B</th>
            <th>C</th>
            <th>D</th>
            <th>E</th>
            <th>F</th>
            <th>G</th>
        </tr>
    </thead>
</table>

0 个答案:

没有答案
相关问题