数据表第二页不呈现

时间:2018-04-23 21:03:13

标签: javascript jquery datatable datatables

我正在使用Datatable来渲染表格。代码是 -

var nextPage;
$(document).ready(function() {
$('#table').DataTable( {
    "processing": true,
    "ordering": false,
    "serverSide": true,
    "sorting":false,
    "paging": true,
    "pageLength":20,
    "lengthChange" :false,
    "pagingType":"simple",
    "ajax": function (data, callback, settings) {
        data.nextPage=document.getElementById("nextPage").value
        $.ajax({url: "get/list", data: data, success: function(result){
            document.getElementById("nextPage").value=result.nextPage;
            callback(result);
        }});
    },
    "columns": [
        { "data": "first_name" },
        { "data": "title" },
        { "data": "first_name"  },
        { "data": "first_name" },
        { "data": "first_name" },
        { "data": "first_name" },
        { "data": "work_email" }
        ]

});
});

打开页面时第一页加载正常,但第二页继续加载。第二页的/ get / list API调用成功,但数据未在浏览器上呈现,加载图标继续旋转。

0 个答案:

没有答案