Use server side with params from GET
Use server side with params from GET
jeanpaul2777
Posts: 5Questions: 0Answers: 0
Hi everyone,
Sorry for this simple question, but I am a bit lost how to achieve my goal.
I would like to know how I can load data from mysql via server_processing.php (same as the one in example) by using a variable from GET.
I have a big table (>50000 rows) with non-unique IDs in the first column. Based on the url, my aim is to load entries in datatable with IDs matching the GET variable. I have a feeling that maybe fnServerParam might be the right answer, but I dont really know how to proceed.
Thank you for your help
[code]
url is like http://localhost/entry.php?var=00000000028
<?php $entry=$_GET['var'];?>
...
$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bStateSave": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "php/server_processing.php",
"sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "/datatable/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
},
...
[/code]
Sorry for this simple question, but I am a bit lost how to achieve my goal.
I would like to know how I can load data from mysql via server_processing.php (same as the one in example) by using a variable from GET.
I have a big table (>50000 rows) with non-unique IDs in the first column. Based on the url, my aim is to load entries in datatable with IDs matching the GET variable. I have a feeling that maybe fnServerParam might be the right answer, but I dont really know how to proceed.
Thank you for your help
[code]
url is like http://localhost/entry.php?var=00000000028
<?php $entry=$_GET['var'];?>
...
$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bStateSave": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "php/server_processing.php",
"sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "/datatable/extras/TableTools/media/swf/copy_csv_xls_pdf.swf"
},
...
[/code]
This discussion has been closed.
Replies
Allan
I had the feeling I should proceed by using fnServerParams,
but I dont know what to write in the "fnServerParams":
eg: aoData.push( { "name": "ID", "value": "<?php $entry?>" } );
Moreover, I dont understand how the server can interpret this new pair values in Params?
Shall I add extra-code in server_processing.php to deal with it?
Sorry this is probably a trivial question, I am noob at programming ^^
Again thank you for your amazing work, it would be really useful for my collegues
JP
> Shall I add extra-code in server_processing.php to deal with it?
Yes :-). If you define extra parameters, then the server will either ignore them, or do something with them. If you want it to do something, you need to tell it what.
Allan