数据表服务器端响应无显示

时间:2019-09-10 00:52:13

标签: ajax datatables

你好,我在服务器端有数据,但响应数据没有显示在ajax中

此错误显示 enter image description here

我尝试检查元素响应数据未显示 enter image description here

这是我的代码

<table id="example" class="display table table-striped custom-table datatable">
                        <thead>
                            <tr>
                                <th>Username</th>
                                <th>Email</th>
                                <th>Level</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
<script>
var dTable;
            $(document).ready(function() {
                dTable = $('#example').DataTable( {
                    "bProcessing": true,
                    "bServerSide": true,
                    "bJQueryUI": false,
                    "responsive": false,
                    "autoWidth": false,
                    "sAjaxSource": "list_rest", //file php
                    "sServerMethod": "POST",
                    "scrollX": true,
                    "scrollY": "350px",
                    "scrollCollapse": true,
                    "columnDefs": [
                    { "orderable": false, "targets": 0, "searchable": false},
                    { "orderable": true, "targets": 1, "searchable": true},
                    { "orderable": true, "targets": 2, "searchable": true}
                    ]
                } );
        });
</script>

返回 list_rest

{"sEcho":"0","iTotalRecords":1,"iTotalDisplayRecords":1,"aaData":[["admin","admin@admin.com","moderator"]]}

enter image description here

帮帮我,如何解决? 谢谢

0 个答案:

没有答案