title: DataTables warning: table id=example - Invalid JSON response. I have no response from server
body: <p>I am trying to make <a href="https://datatables.net/examples/server_side/simple.html" rel="nofollow noreferrer">DataTables.js (Server-side Processing)</a> working for my custom CMS, unfortunately the default server-side script isn't returning any result.</p>
  
  <p><a href="https://i.stack.imgur.com/QuEYJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QuEYJ.png" alt="enter image description here"></a></p>
  
  <p>Of course I entered my database credentials into it, and chosen an existing table in my database.</p>
  
  <p>I have no error in my apache logs.</p>
  
  <p>This guy in DataTables.js forum had exactly same issue:</p>
  
  <p><a href="https://datatables.net/forums/discussion/27049/datatables-warning-table-id-example-invalid-json-response-but-no-response-with-server-side-exampl" rel="nofollow noreferrer">https://datatables.net/forums/discussion/27049/datatables-warning-table-id-example-invalid-json-response-but-no-response-with-server-side-exampl</a></p>
  
  <p>But apparently he solved it by installing PDO in the server. I verified and my server has already PDO installed.</p>
  
  <p>Any idea?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>As asked, here is the code I am using. Actually it's exactly same as the example there: <a href="https://datatables.net/examples/server_side/simple.html" rel="nofollow noreferrer">https://datatables.net/examples/server_side/simple.html</a></p>
  
  <p>HTML</p>
  
  <pre><code>&lt;table id="example" class="display" cellspacing="0" width="100%"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;First name&lt;/th&gt;
              &lt;th&gt;Last name&lt;/th&gt;
              &lt;th&gt;Position&lt;/th&gt;
              &lt;th&gt;Office&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tfoot&gt;
          &lt;tr&gt;
              &lt;th&gt;First name&lt;/th&gt;
              &lt;th&gt;Last name&lt;/th&gt;
              &lt;th&gt;Position&lt;/th&gt;
              &lt;th&gt;Office&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/tfoot&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>$('#example').DataTable( {
      "processing": true,
      "serverSide": true,
      "ajax": "/server_processing.php"
  } );
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?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' =&gt; 'nid', 'dt' =&gt; 0 ),
      array( 'db' =&gt; 'type',  'dt' =&gt; 1 ),
      array( 'db' =&gt; 'language',   'dt' =&gt; 2 ),
      array( 'db' =&gt; 'title',     'dt' =&gt; 3 ),
  );
  
  // SQL server connection information
  $sql_details = array(
      'user' =&gt; '******',
      'pass' =&gt; '******',
      'db'   =&gt; '******',
      'host' =&gt; '******'
  );
  
  
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * 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 )
  );
  </code></pre>
  
  <p>Here is a link to the sample script in my server:</p>
  
  <p><a href="http://tests.krown.ch/examples/server_side/simple.html" rel="nofollow noreferrer">http://tests.krown.ch/examples/server_side/simple.html</a></p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>My server has PDO working on it:</p>
  
  <p><a href="https://i.stack.imgur.com/1Lr7M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Lr7M.png" alt="enter image description here"></a></p>
  
  <p>I also checked with <code>class_exists('PDO')</code> </p>
  
  <p>The credentials are good because if I change them, I will get some other errors telling me credentials are not good or database was not found.</p>
  
  <p>The table in database I am testing is that one:</p>
  
  <p><a href="https://i.stack.imgur.com/HA7G9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HA7G9.png" alt="enter image description here"></a></p>