DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be

DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be

IijimaIijima Posts: 1Questions: 0Answers: 0
edited April 2013 in Editor
Allan,

"editor" was purchased and it was installed, the following message appears.

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

The version of PHP was 5.3.12 although he thought whether to have been a version of php.

"editor" uses 1.2.3 and "datatables" uses 1.9.4.
It installs with a setup of the following sites and has not changed other than config.php.

http://editor.datatables.net/tutorials/installing

Please teach me how to avoid an error.

Regards,
iijima

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Hi iijima,

    There are a number of things that can cause this error, from invalid PHP to incorrect database access, and from PHP versions to database fields.

    Fundamentally we need to know what is being returned from the server, instead of valid JSON to be able help resolve the issue. You can find this out using the developer tools in Chrome / Safari or Firebug in Firefox (to look at the XHR return from the server). What is being returned from the server? It likely contains an error message.

    Allan
  • efirvidaefirvida Posts: 3Questions: 0Answers: 0
    Allan,
    I have exactly the same situation, the XHR return is the following:
    <?php

    /*
    * Example PHP implementation used for the index.html example
    */

    // DataTables PHP library
    include( "lib/DataTables.php" );

    // Alias Editor classes so they are easy to use
    use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Join,
    DataTables\Editor\Validate;

    // Build our Editor instance and process the data coming from _POST
    Editor::inst( $db, 'browsers' )
    ->fields(
    Field::inst( 'engine' )->validator( 'Validate::required' ),
    Field::inst( 'browser' )->validator( 'Validate::required' ),
    Field::inst( 'platform' ),
    Field::inst( 'version' ),
    Field::inst( 'grade' )->validator( 'Validate::required' )
    )
    ->process( $_POST )
    ->json();

    please. could you help me with this, it's driving me crazy
    Jane
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Hi Jane,

    Please post a link to a test case showing the problem: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read . Failing that, please use the debugger so I can see what might be happening.

    Allan
This discussion has been closed.