jquery数据表搜索不起作用,但其他一切都很好


jquery datatables search not working, but everything else is fine

服务器端数据表。除了搜索框外,一切都很好。一旦我在搜索中输入一个字符,就会显示此错误:

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

第99行是绑定参数中的-$statement->execute();

我正在为此处列出的数据表使用pdo脚本

这是一个SQL错误,而不是Jquery。。。请检查您传递的参数。。

您收到的错误是因为php代码出错。jQuery只是加载您的php页面并提供输出


在php代码中,尝试将emulate prepares设置为false,这可能会导致问题。当我把它设置为false时,它对我有效。

在此处验证您的JSon响应http://jsonlint.com/检查它是无效的还是有效的JSON
此外,一旦您在搜索框中输入一些数据,Jquery就会启动命令
请尝试检查数据库属性类型是否存在错误(数字或文本)

相关文章: