The error message suggests that there is an issue with the Ajax request. However, the problem may be related to the fact that the default content for all columns is set to "-". This means that if a column has a null value, it will be replaced with "-". To show empty cells instead, you can modify the "defaultContent" property to an empty string. Here's an example:
var table = $('.user_table').DataTable({
processing: true,
serverSide: true,
"columnDefs": [{
"defaultContent": "",
"targets": "_all"
}],
ajax:{
url:"{{ route('users.index') }}",
dataType: "json",
type:"GET",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
},
columns: [
{data: 'DT_RowIndex', name: 'DT_RowIndex'},
{data: 'name', name: 'name'},
{data: 'email', name: 'email'},
{data: 'phone', name: 'phone'},
{data: 'address', name: 'address'},
{
data: 'action',
name: 'action',
orderable: false,
searchable: false
},
]
});
By setting the "defaultContent" property to an empty string, null values will be displayed as empty cells in the DataTable.
