Datatables TypeError: c is undefined
Datatables TypeError: c is undefined
我尝试使用jQuery DataTables,但是出现了以下错误:
TypeError: c is undefined
我不知道我的代码有什么问题,因为我可以看到JSON正确获取并且格式也正确,但是我不知道为什么会出现上面的错误。
我的JSON数据:
{"Data":[{"LOGIN":10184},{"LOGIN":10214},{"LOGIN":10180},{"LOGIN":10187},{"LOGIN":10179},{"LOGIN":10280},{"LOGIN":201},{"LOGIN":10238},{"LOGIN":10296},{"LOGIN":10312}]}
我的DataTables代码:
$(document).ready(function() { $('#tablename').dataTable( { "processing": true, "serverSide": true, "ajax": { "type": "POST", "url": "https://test.com/api/db/select", "data": function ( json ) { return JSON.stringify( { "Sql": 12 } );}, "contentType": "application/json; charset=utf-8", "dataType": "json", "processData": true, beforeSend : function(xhr){ var access_token = sessionStorage.getItem('access_token'); xhr.setRequestHeader('Authorization', 'Bearer ' + access_token); } }, "dataSrc": "Data", "columns": [ { "data": "LOGIN" } ] } ); } );