DataTables warning: table id=datatable-fixed-header1 - Invalid JSON response.
DataTables warning: table id=datatable-fixed-header1 - Invalid JSON response.
I am using jQuery DataTables in laravel vuejs and I applied serverside pagination to load the first page only with 5 records when I try to search a record in all table it does not work but the search only works in the 5 loaded data I search in the web and I found that I should set serverSide: true, but when I set that it throws the below error.
DataTables warning: table id=datatable-fixed-header1 - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
Jquery datatable code is below
$(document).ready(function() {
var tables = $("#datatable-fixed-header1").DataTable({
retrieve: true,
processing: true,
serverSide: true,
// paging: false,
dom: "t",
paging: true,
// scrollX: true,
lengthChange: true,
searching: true,
ordering: true
});
});
$(document).on("keyup", "#bookSearch", function() {
var tables = $("#datatable-fixed-header1").DataTable({
retrieve: true,
processing: true,
serverSide: true,
// paging: false,
dom: "t",
paging: true,
// scrollX: true,
lengthChange: true,
searching: true,
ordering: true
});
tables.search($(this).val()).draw();
});
Answers
Did you follow the instructions at the link provided in the error?
Let us know what you find.
Kevin
in the console, it gives me this error
app.js:43082 Uncaught TypeError: Cannot set property 'data' of null
What do you find when you follow the troubleshooting steps in the link?
http://datatables.net/tn/1
Kevin
the table is loaded successfully but When I try to search for data on the second page after pagination it does not work and in the console, it gives me this error
Uncaught TypeError: Cannot set property 'data' of null
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
why search is not working with serverside pagination ?
The server script is responsible for searching using this protocol:
https://datatables.net/manual/server-side
Are you using a Datatables provided server script?
Does your script support the server side protocol?
You can use the steps in the technote link of the error to see what the server response is.
If this doesn't help then as Colin mentioned we will need to have a link to your page to help debug.
Kevin
I could not post the link because I am developing the application in the local system so here are the attached pictures
one more picture
The problem is with your server script not returning the correct data. You will need to look at your server script for errors. You didn't answer any of my questions in the last post regarding your server script.
Kevin