issue with ssp.class.php

issue with ssp.class.php

ikelcaikelca Posts: 19Questions: 7Answers: 0

Hello,

I'm using ssp.class.php sample from herehttps://github.com/DataTables/DataTablesSrc/blob/master/examples/server_side/scripts/ssp.class.php

It's original and hasn't been changed, I was doing a testing run, and on macOS(chrome and safari), it works fine, but when open the same webpage on windows with chrome or edge, it gives error

DataTables warning: table id=itemDetailsTable - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
and error is from ajax sending server request.

I did a little troubleshooting by adding print_r($variables) in ssp.class.php see below ( i added print_r($request['columns']); in line 124) and as you can see on windows, $request['columns'] is somehow incomplete(missing some elements including index 0), but on macOS it's complete(starting from index 0)

windows screenshot

macOS screenshot

code where it has issues

does anyone have idea how to fix this?

thanks

Answers

  • ikelcaikelca Posts: 19Questions: 7Answers: 0
    edited October 2019

    to me it looks like on windows browsers choose to ignore for a few element in $request[columns], not sure why

    If i change ajax method from GET to POST, I got brew error on both windows and macOS

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) in /Users/developer/Documents/GitHub/inventorywebsite/www/ssp.class.php on line 447

  • allanallan Posts: 63,186Questions: 1Answers: 10,411 Site admin

    That would be the oddest thing! Can you link me to the page so I can run it in a browser in Windows and MacOS and see what the issue might be please?

    Allan

  • ikelcaikelca Posts: 19Questions: 7Answers: 0

    I think i figured out

    im using server-side with ajax sending by POST method

    var table = $('#itemDetailsTable').DataTable({
    "lengthMenu": [[15, 30, 50], [15, 30, 50]],
    "scrollY": 500,
    "scrollX": true,
    "deferRender": true,
    "processing": true,
    "serverSide": true,
    "rowId":true,
    // "order": [],
    "ajax":{"url":"processing.php","type":"POST"}

    but in processing.php I just used default example where

    require( 'ssp.class.php' );

    echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns)
    );

    it uses _GET instead of _POST, which causes intermittent issue.
    Once I changed to _POST, it all looks ok now.

    Thank you

This discussion has been closed.