user756659
user756659

Reputation: 3510

jquery datatables search not working, but everything else is fine

Server-side datatables. everything is working fine except the search box. Soon as I enter one character in the search, this error shows up:

DataTables warning (table id = 'sample_1'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number' in /home/test/public_html/assets/data-tables/test-pdo.php:99
Stack trace:
#0 /home/test/public_html/assets/data-tables/test-pdo.php(99): PDOStatement->execute()
#1 /home/test/public_html/assets/data-tables/test-pdo.php(143): TableData->get('accounts', 'account_id', Array)
#2 {main}
thrown in /home/test/public_html/assets/data-tables/test-pdo.php on line 99

line 99 is -$statement->execute(); from Bind Parameters

I am using the pdo script for datatables listed here

Upvotes: 2

Views: 877

Answers (3)

Devendra Lattu
Devendra Lattu

Reputation: 2812

Validate your JSon response here http://jsonlint.com/ Check if its an invalid or a valid JSON.
Also your Jquery is firing command as soon as you enter some data in search box.
Try checking the Database attribute type for errors (Number or text).

Upvotes: 0

h2O
h2O

Reputation: 544

The error which you are receiving is because you went something wrong in your php code. jQuery just loads your php page and gives you the output.


In your php code, try setting emulate prepares to false which may be causing the problem. It worked for me when I set it to false.

Upvotes: 1

M.R
M.R

Reputation: 526

this is a SQL error not Jquery... Please check your passed parameters..

Upvotes: 4

Related Questions