passing data to the server_processing.php script

passing data to the server_processing.php script

bastringuebastringue Posts: 7Questions: 4Answers: 1

Hello all,
I need an enlightment on the server-side utilization of DataTables, if you please...

As done in the server side provided example, I have used the following option in my test :
"ajax": "scripts/server_processing.php"

This option consists in giving an url wich corresponds to the script that ajax should run to get the data. I then wrote a customized server_processing.php script which uses the SSP class to generate the json data out of a sql query to my database...

I faced the problem of sending some parameters to this script : It is important to note (if i am not mistaking) that it is just a script (!) without any 'http treatment' of its content (for example, the script cannot access any $_SESSSION data).

The only way I found to send parameters is to add a key/value list to the url definition (scripts/server_processing.php?a=1) and this GET mechanism works also for an array, with serialisation.

This point is an issue (for me) as I have to send specific information, in particular the database identifier and password. How could I safely give the database connexion identifiers to this script?

In the meantime, this is what i did so far and that works: at least, the script connects to the DB, send queries, and the table is correctly drawn.

But globally, I think i am missing something important in this server-side' mechanism...for instance :

  • There is an option "serverSide": true/false (false by default) and that puzzles me: How this couldn't be a 'server side treatement' as we send the query to a database server? By the way, I haven't activated the option and yet, the script correctly connects to the database and generates the json file (and it doesn't work if i activate the option!)

  • GET mechanism? When we give a "search string" or click on a column header to order it, this action produces a GET mechanism (?). The script receives the new values (in the $request variable), computes a new "WHERE" clause and send a new query. Is it sent to the database server or to an internal engine ? The json data is then updated and the table is redrawn... Is this correct ?

    • Finally, i have seen a POST option in the documentation: I guess I will be able to understand this option if I get clearer on the previous points, before...

Thank you for reading and telling me what I am missing..(and thank you for sharing dataTables)
Pierre

This discussion has been closed.