Skip to content
Advertisement

Datatables warning table id=datatables-example – invalid json response

Here I am new to ajax DataTables. I am trying to connect my database and fetch records to the dataTable. But I got this error:

datatables warning table id=datatables-example – invalid json responseFor more information about this error, please see http://datatables.net/tn/1

I have followed the tutorial called web lesson, in case I tried to find a solutions on internet but didn’t help me to solve my problem. Here is my HTML segments:

JavaScript

Below is the Ajax segments:

JavaScript

The apt_table admin.php page should be:

JavaScript

I don’t know where I went wrong. Please help me. Thanks in advance.

Advertisement

Answer

to implement server-side ajax datatable your script should return json only you are sending html with some <tr> and <td>

Refer: https://datatables.net/examples/data_sources/server_side

in above example source is giving json output only.

So, try to fix your apt_table admin.php

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement