jQuery datatables不显示数据库中的数据

jQuery datatables不显示数据库中的数据,datatables,Datatables,使用ajax调用数据库显示数据时遇到问题。数据以JSON的形式返回-该部分正在工作。但我得到了一个错误: Uncaught TypeError: Cannot read property 'length' of undefined at ub (jquery.dataTables.min.js:39) at jquery.dataTables.min.js:37 at i (jquery.dataTables.min.js:35) at Object.success (jquery.dataTa

使用ajax调用数据库显示数据时遇到问题。数据以JSON的形式返回-该部分正在工作。但我得到了一个错误:

Uncaught TypeError: Cannot read property 'length' of undefined
at ub (jquery.dataTables.min.js:39)
at jquery.dataTables.min.js:37
at i (jquery.dataTables.min.js:35)
at Object.success (jquery.dataTables.min.js:35)
at l (jquery.min.js:4)
at Object.fireWith [as resolveWith] (jquery.min.js:4)
at k (jquery.min.js:6)
at XMLHttpRequest.<anonymous> (jquery.min.js:6)
从我的php页面返回的json如下所示:

<table id="dataTable" class="display" style="width:100%; background-color:white;">
    <thead>
        <tr>
            <th>Lot ID</th>
        </tr>
    </thead>
</table>
$('#dataTable').DataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "php/getAllLots.php",
"type": "POST"
},
"columns": [
{ "data": "LotID" }

} );
[{"LotID":"1"},{"LotID":"2"},{"LotID":"3"},{"LotID":"4"},{"LotID":"5"},{"LotID":"6"},{"LotID":"7"},{"LotID":"8"},{"LotID":"9"},{"LotID":"10"},{"LotID":"11"},{"LotID":"12"},{"LotID":"13"},{"LotID":"14"},{"LotID":"15"},{"LotID":"16"},{"LotID":"17"},{"LotID":"18"},{"LotID":"19"},{"LotID":"20"},{"LotID":"21"},{"LotID":"22"},{"LotID":"23"},{"LotID":"24"},{"LotID":"25"},{"LotID":"26"},{"LotID":"27"},{"LotID":"28"},{"LotID":"29"},{"LotID":"30"},{"LotID":"31"},{"LotID":"32"},{"LotID":"33"},{"LotID":"34"},{"LotID":"35"},{"LotID":"36"},{"LotID":"37"},{"LotID":"38"},{"LotID":"39"},{"LotID":"40"},{"LotID":"41"},{"LotID":"42"},{"LotID":"43"},{"LotID":"44"},{"LotID":"45"},{"LotID":"46"},{"LotID":"47"},{"LotID":"48"},{"LotID":"49"},{"LotID":"50"},{"LotID":"51"},{"LotID":"52"},{"LotID":"53"},{"LotID":"54"},{"LotID":"55"},{"LotID":"56"},{"LotID":"57"},{"LotID":"58"},{"LotID":"59"},{"LotID":"60"},{"LotID":"61"},{"LotID":"62"},{"LotID":"63"},{"LotID":"64"},{"LotID":"65"},{"LotID":"66"},{"LotID":"67"},{"LotID":"68"},{"LotID":"69"},{"LotID":"70"},{"LotID":"71"},{"LotID":"72"},{"LotID":"73"},{"LotID":"74"},{"LotID":"75"},{"LotID":"76"},{"LotID":"78"},{"LotID":"79"},{"LotID":"80"},{"LotID":"81"},{"LotID":"82"},{"LotID":"83"},{"LotID":"84"},{"LotID":"85"},{"LotID":"86"},{"LotID":"87"},{"LotID":"88"},{"LotID":"89"},{"LotID":"90"},{"LotID":"91"},{"LotID":"92"},{"LotID":"93"},{"LotID":"94"},{"LotID":"95"},{"LotID":"96"},{"LotID":"97"},{"LotID":"98"},{"LotID":"99"},{"LotID":"100"},{"LotID":"101"},{"LotID":"102"},{"LotID":"103"},{"LotID":"104"},{"LotID":"105"},{"LotID":"106"},{"LotID":"107"},{"LotID":"108"},{"LotID":"109"},{"LotID":"110"},{"LotID":"111"},{"LotID":"112"},{"LotID":"113"},{"LotID":"114"},{"LotID":"115"},{"LotID":"116"},{"LotID":"117"},{"LotID":"118"},{"LotID":"119"},{"LotID":"120"},{"LotID":"121"},{"LotID":"122"},{"LotID":"123"},{"LotID":"124"},{"LotID":"125"},{"LotID":"126"},{"LotID":"127"},{"LotID":"128"},{"LotID":"129"},{"LotID":"130"},{"LotID":"131"},{"LotID":"132"},{"LotID":"133"},{"LotID":"134"},{"LotID":"135"},{"LotID":"136"},{"LotID":"137"},{"LotID":"138"},{"LotID":"139"},{"LotID":"140"},{"LotID":"141"},{"LotID":"142"},{"LotID":"143"},{"LotID":"144"},{"LotID":"145"},{"LotID":"146"},{"LotID":"147"},{"LotID":"148"},{"LotID":"149"},{"LotID":"150"},{"LotID":"151"},{"LotID":"152"},{"LotID":"153"},{"LotID":"154"},{"LotID":"155"},{"LotID":"156"},{"LotID":"157"},{"LotID":"158"},{"LotID":"159"},{"LotID":"160"},{"LotID":"161"},{"LotID":"162"},{"LotID":"163"},{"LotID":"164"},{"LotID":"165"},{"LotID":"166"},{"LotID":"167"},{"LotID":"168"},{"LotID":"169"},{"LotID":"170"},{"LotID":"171"},{"LotID":"172"},{"LotID":"173"},{"LotID":"174"},{"LotID":"175"},{"LotID":"176"},{"LotID":"177"},{"LotID":"178"},{"LotID":"179"},{"LotID":"180"},{"LotID":"181"},{"LotID":"182"},{"LotID":"183"},{"LotID":"184"},{"LotID":"185"},{"LotID":"186"},{"LotID":"187"},{"LotID":"188"},{"LotID":"189"},{"LotID":"190"},{"LotID":"191"},{"LotID":"192"},{"LotID":"193"},{"LotID":"194"},{"LotID":"195"},{"LotID":"196"},{"LotID":"197"},{"LotID":"198"},{"LotID":"199"},{"LotID":"200"},{"LotID":"201"},{"LotID":"202"},{"LotID":"203"},{"LotID":"204"},{"LotID":"205"},{"LotID":"206"},{"LotID":"207"},{"LotID":"208"},{"LotID":"209"},{"LotID":"210"},{"LotID":"211"},{"LotID":"212"},{"LotID":"213"},{"LotID":"214"},{"LotID":"215"},{"LotID":"216"},{"LotID":"217"},{"LotID":"218"},{"LotID":"219"},{"LotID":"220"},{"LotID":"221"},{"LotID":"222"},{"LotID":"223"},{"LotID":"224"},{"LotID":"225"},{"LotID":"226"},{"LotID":"227"},{"LotID":"228"},{"LotID":"229"},{"LotID":"230"},{"LotID":"231"},{"LotID":"232"},{"LotID":"233"},{"LotID":"234"},{"LotID":"235"},{"LotID":"236"},{"LotID":"237"},{"LotID":"238"},{"LotID":"239"},{"LotID":"240"},{"LotID":"241"},{"LotID":"242"},{"LotID":"243"},{"LotID":"244"},{"LotID":"245"},{"LotID":"246"},{"LotID":"247"},{"LotID":"248"},{"LotID":"249"},{"LotID":"250"},{"LotID":"251"},{"LotID":"252"},{"LotID":"253"},{"LotID":"254"},{"LotID":"255"},{"LotID":"256"},{"LotID":"257"},{"LotID":"258"},{"LotID":"259"},{"LotID":"260"},{"LotID":"261"},{"LotID":"262"},{"LotID":"263"},{"LotID":"264"},{"LotID":"265"},{"LotID":"266"},{"LotID":"267"},{"LotID":"268"},{"LotID":"269"},{"LotID":"270"},{"LotID":"271"},{"LotID":"272"},{"LotID":"273"},{"LotID":"274"},{"LotID":"275"},{"LotID":"276"},{"LotID":"277"},{"LotID":"278"},{"LotID":"279"},{"LotID":"280"},{"LotID":"281"},{"LotID":"282"},{"LotID":"283"},{"LotID":"284"},{"LotID":"285"},{"LotID":"286"},{"LotID":"287"},{"LotID":"288"},{"LotID":"289"},{"LotID":"290"},{"LotID":"291"},{"LotID":"292"},{"LotID":"293"},{"LotID":"294"},{"LotID":"295"},{"LotID":"296"},{"LotID":"297"},{"LotID":"298"},{"LotID":"299"},{"LotID":"300"},{"LotID":"301"}]

谁能告诉我我做错了什么吗?

HTML和js代码中的列数不匹配。请验证并检查它是否有效。我猜URA_buyout的列条目丢失了。

关于该字段丢失的说法你是对的,但在我更正它之后,我得到了错误jquery.dataTables.min.js:39 Uncaught TypeError:无法读取jquery.dataTables.min.js:37 at I的ub(jquery.dataTables.min.js:39)的undefined属性'length'(jquery.dataTables.min.js:35)在Object.success(jquery.dataTables.min.js:35)在l(jquery.min.js:4)在Object.fireWith[as resolveWith](jquery.min.js:4)在XMLHttpRequest的k(jquery.min.js:6)处。(jquery.min.js:6)请您也添加标记并检查。我已将问题简化为1个字段,但仍会出现该错误。我添加了标记,但没有改变任何内容。不知何故,数据没有出现在页面上。