Invalid json response datatables with Laravel 5.1
Invalid json response datatables with Laravel 5.1
Hi,
I have just been following this tutorial on http://datatables.yajrabox.com/starter#well-done . I get a blank table with an error of invalid json response. When I validate my url on http://jsonlint.com i get this error
Expecting '{', '['
When i do a dd(Datatables::of(Remit::select('*'))->make(true)) I do get results from my remit table on the browser so the query cant be the problem.
Could anyone have an idea where to change the json format sent from the server? I tried playing around with this block of code but with no luck
$(function() {
$('#remit-table').DataTable(
{
processing: true,
serverSide: true,
ajax: '{!! route('datatables.data') !!}',
columns: [
{ data: 'id', name: 'id' },
{ data: 'name', name: 'name' },
{ data: 'reference', name: 'reference' },
{ data: 'mobile', name: 'mobile' },
{ data: 'billing', name: 'billing' }
]
});
});
Replies
JSON Lint is not a URL validator. It is a JSON validator. Get the return from the Ajax request using your browser's developer tools.
This is not a Laravel forum - if you are having issues with laravel, I would suggest asking in one of their support channels.
Allan