Failed to run Server Side Examples

Failed to run Server Side Examples

hheydarihheydari Posts: 2Questions: 0Answers: 0
edited July 2012 in General
Hi,

I'm new to DataTables, and I just tired to see how server side examples work but none of them show the table and instead a warning is shown saying: [quote] DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error. [/quote]

For example I tried to run row_details and I got this warning, here is my DataTable Debugger result: http://debug.datatables.net/uvizew

Please help me,
Thanks.

Replies

  • DenonthDenonth Posts: 76Questions: 0Answers: 0
    edited July 2012
    I had a same issues and it was always JSON format error for me. So check that.
    Send us your query
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    edited July 2012
    @hheydari - have a look at what the server is sending back. It isn't valid JSON:

    [code]
    Warning: include(C:/wamp / www //datatables/mysql.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\DataTables-1.9.2\examples\server_side\scripts\details_col.php on line 24
    [/code]

    You need to modify the files in examples/server_side/scripts to include a file which makes the db connection. Something like:

    [code]
    <?php
    $gaSql['user'] = "";
    $gaSql['password'] = "";
    $gaSql['db'] = "";
    $gaSql['server'] = "localhost";
    $gaSql['type'] = "mysql";
    ?>
    [/code]

    Allan
  • hheydarihheydari Posts: 2Questions: 0Answers: 0
    edited July 2012
    Dear Allan thank you for your response,

    Such a stupid I am!

    I should have removed the line (or maybe toggle comment):

    [quote]/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
    include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" ); [/quote]

    Hamed.
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Just replace it with the code I suggested above. I'll look at making this condition more obvious in future, since server-side processing does of course require some kind of configuration for the server to be done :-)

    Allan
This discussion has been closed.