Hello, I am trying to use datatable in my laravel project. But I am getting this CSRF Token Mismatch error how do I solve that?
$(document).ready(function () {
$('#my-table').DataTable({
processing: true,
serverSide: true,
serverMethod: 'post',
ajax: 'ajax-url',
columns: [
{ data: 'name' },
{ data: 'position' },
{ data: 'office' }
],
});
});
I know I can send CSRF Token to laravel server like below.
"data": {
"_token": "{{ csrf_token() }}"
},
But this is not working with datatable. Is there any way I can send additional parameters with the ajax request?