I am trying to populate a table from the DataTables js library. The data is extracted by the php script which I pass as the ajax parameter, just like the example on the datatables site specifies.
However, I get the error that the response is not valid json. Looking at my dev tools, I can see that it is not! In fact, the response is simply the complete contents of the php script which is suppose to run and return some data.
So, the DataTables function is seeing the ajax parameter as a source of the data (and thus tries to interpret it as json) and not a script to run, which will return the data.
What am I doing wrong?
Here is the javascript which calls the php:
$("#dataBilling").DataTable({
"processing":true,
"serverSide": true,
"ajax":"scripts/readfromdb.php"
});
The contents of readfromdb.php is not relevant, since no matter what it is, it is not even being executed. Like I said, devtools shows the XHR response as the entire contents of that php file.