我正在尝试从我的数据库中获取数据到数据表。这是我的数据表脚本:
var table = $('#teamTable').DataTable({
dom: 'Bfrtip',
pageLength: 25,
"ajax":{
url :"/teamsPopulate",
dataType: 'json',
},
columns: [
{ data: "id" },
{ data: "name" },
{ data: "parent_id" },
{ data: "created_at" },
{ data: "update_at" }],
serverSide : true,
"bProcessing": true,
select: 'multiple',
responsive: true,
altEditor: true,
buttons: [{
text: 'Add',
name: 'add'
},
{
extend: 'selected',
text: 'Edit',
name: 'edit'
}]
});
这是我的控制器脚本
public function getTeamContents(){
$teams = Team::all();
return response ()->json( $teams );
}
这是我的观点
<table class="table table-striped table-bordered table-hover dataTables-example" id="teamTable">
<thead>
<tr>
<th></th><th></th><th></th><th></th><th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td><td></td><td></td><td></td><td></td>
</tr>
</tbody>
</table>
我哪里出错了?请帮忙。