datatables Ajax-Error / http://datatables.net/tn/7

时间:2016-10-13 08:47:13

标签: jquery ajax laravel datatables

我在laravel web应用程序中使用datatable。 当我显示6列时它工作正常,但是当再添加一列时,我得到错误http://datatables.net/tn/7

此处表格标题

<table class="datatable mdl-data-table dataTable" cellspacing="0"
    width="100%" role="grid" 
    style="width: 100%;">
    <thead>
        <tr>
            <th>ID</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Email</th>
            <th>Gender</th>
            <th>Country</th>
            <th>Salary</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>

这里是视图

$(document).ready(function(){
  $('.datatable').DataTable({
        processing: true,
        serverSide: true,
        ajax: '{{ route('api.GetData') }}',
        columns:[
        {$data:'id', name:'id'},
        {$data:'first_name', name:'first_name'},
        {$data:'last_name', name:'last_name'},
        {$data:'email', name:'email'},
        {$data:'gender', name:'gender'},
        {$data:'country', name:'country'},
        {$data:'salary', name:'salary'}
        ]
    });
});

如何解决此错误?

0 个答案:

没有答案