datatable fix error–Invalid JSON response

error

This error is pretty common.

Meaning:
When loading data by Ajax(ajax|option).DataTables by default, expects the data loaded to be valid JSON.

DataTables warning:table id ={id} – Invalid JSON response
It means exactly what is says. DataTables made an Ajax response to the server for JSON data, but the data that
it received back was not valid JSON.

Diagnosis:
First of all, checking what it exactly reply with.Typically, the reponse will consist of an error message from the program
on the server which is being used to create the JSON, which will be the starting poing for resolving the issue fully.

Using firefox web developer tools to get the received JSON.

For my case, the root case is the php code is missing variable defination.

原文地址:https://www.cnblogs.com/heylinart/p/6925491.html