数据库表为空时DataTables警告

时间:2018-06-18 05:29:48

标签: json ajax datatable

我在数据库表中没有记录时有问题提取记录。我收到以下警告:

DataTables warning: table id=example - Invalid JSON response. For more
information about this error, please see http://datatables.net/tn/

当记录存在比工作得好。请帮我解决警告。

<script>
    $(document).ready(function () {
        var oTable = $('#example').dataTable({
            /* "bStateSave": true,
            "ServerSide": true,*/
            dom: "Bfrtip",
            "scrollX": true,
            "sPaginationType": "full_numbers",
            "bProcessing": true,
            "sAjaxSource": "<?php echo base_url()?>item/listing",
            "aoColumns": [{
                "mData": 0,
                "visible": false,
                "searchable": false,
                }, {
                "sWidth": "12%",
                "mData": 1,
                }, {
                "sWidth": "12%",
                "mData": 2
                }, {
                "sWidth": "16%",
                "mData": 3 
                }

        })
    })
</script>

0 个答案:

没有答案