DataTables.js (Server-side Processing)私のカスタムCMSのために働くようにしようとしていますが、残念ながらデフォルトのサーバーサイドスクリプトは結果を返していません。もちろんDataTables警告:table id = example - 無効なJSON応答です。私はサーバーからの応答がありません
私はそれに私のデータベースの資格情報を入力して、自分のデータベース内の既存のテーブルを選択しました。
私のApacheのログにエラーはありません。
DataTables.jsフォーラムでこの男は、まったく同じ問題が持っていた:
をしかし、どうやら彼は、サーバーにPDOをインストールすることによってそれを解決しました。私は確認して、私のサーバーはすでにPDOがインストールされています。
編集
尋ねたとして、ここで私が使用していたコードです。私のサーバーでのサンプル・スクリプトへのリンクがhttps://datatables.net/examples/server_side/simple.html
HTML
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
</tr>
</thead>
<tfoot>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
</tr>
</tfoot>
</table>
はJavaScript
$('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": "/server_processing.php"
});
PHPここ
<?php
/*
* DataTables example server-side processing script.
*
* Please note that this script is intentionally extremely simply to show how
* server-side processing can be implemented, and probably shouldn't be used as
* the basis for a large complex system. It is suitable for simple use cases as
* for learning.
*
* See http://datatables.net/usage/server-side for full details on the server-
* side processing requirements of DataTables.
*
* @license MIT - http://datatables.net/license_mit
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
// DB table to use
$table = 'node';
// Table's primary key
$primaryKey = 'nid';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array('db' => 'nid', 'dt' => 0),
array('db' => 'type', 'dt' => 1),
array('db' => 'language', 'dt' => 2),
array('db' => 'title', 'dt' => 3),
);
// SQL server connection information
$sql_details = array(
'user' => '******',
'pass' => '******',
'db' => '******',
'host' => '******'
);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/
require('ssp.class.php');
echo json_encode(
SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns)
);
されています。実際にはそこの例とまったく同じです。
http://tests.krown.ch/examples/server_side/simple.html
編集2
私のサーバーは、PDOはそれに取り組んでいます
私もclass_exists('PDO')
で確認証明書が、私はそれらを変更するためならば良いです、私は資格情報が良くない、またはデータベースがfounderではないことを伝える他のいくつかのエラーを取得しますd。
私がテストしていたデータベース内のテーブルは1点である。問題は、ファイルssp.class.php
を持っていないですように見えます
DataTablesの初期化コード、HTMLマークアップ、およびサーバーの応答を表示します。 –
HTML、JavaScript、PHPコードを投稿しました。サーバーの応答はありません。 – 118218
問題はサーバー側のスクリプトにあります。あなたのスクリプトが何の出力も生成しないという手掛かりを得るために、複数のこと、証明書、テーブル名、PHP PDOサポート、PHPまたはWebサーバーエラーログをチェックすることができます。 –