DataTable displaying JSON ouput rather than HTML table
DataTable displaying JSON ouput rather than HTML table

I am using DataTable with Laravel. My DataTable jQuery code is like below
$('#address_datatable').DataTable({
"order": [],
"columnDefs": [{
"targets": [ 0, 5 ],
"orderable": false
}],
processing: true,
serverSide: true,
ajax: '{{ url('show.addresses') }}',
columns: [
[
{ data: 'id', name: 'id' },
{ data: 'company_name', name: 'company_name' }
]
]
});
My Laravel Route is like below
Route::get('show/addresses', 'AddressController@showAddresses')->name('show.addresses');
My Laravel controller function is like below
public function showAddresses()
{
return DataTables::of(Address::query())->make(true);
}
I am getting output like below
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Nested array there. It should just be:
Allan