我试图使用Ajax请求的条目填充我的表。
我可以确认我的Json数据具有适当的格式,以便在Datatable中显示。
问题是,在请求之后,即使我能够在我的控制台中看到它们,也不会填充条目。
$(document).ready(function () {
var $submitButton = $('.ladda-button[type="button"]').ladda();
var table = $('.table').DataTable({
processing: true,
searching: false,
responsive: true,
filter: false,
deferLoading:0,
serverSide: true,
bLengthChange: false,
bSort: false,
ajax: {
url: "myUrl",
type: 'post',
dataSrc: function (json) {
$submitButton.ladda('stop');
var entries = json.data;
return entries;
}
},
});
$(document).on('click',$submitButton, function(e){
e.preventDefault();
$submitButton.ladda('start');
table.ajax.reload();
return false;
});
});