sending custom parameter for DataTables
sending custom parameter for DataTables
i can use this below code for getting results in server_side file, but i cant send any parameters such az sql query,fields for search, i want to create modular file for use single file in all projects . how to sending custom parameter for DataTables like with this code?
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php"
/*
"SQlQuery":"SELECT * FROM student",
"Columns" :" id , name , code"
*/
} );
} );
[/code]
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "scripts/server_processing.php"
/*
"SQlQuery":"SELECT * FROM student",
"Columns" :" id , name , code"
*/
} );
} );
[/code]
This discussion has been closed.
Replies
Use fnServerParams to send extra data to the server.
Allan
server_side.php
[code]$aColumns = array("{$_POST['lgn']}",'member_id','first_name','last_name' );[/code]
jQuery:[code]
"sAjaxSource" : "server_processing.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "lgn": "login"} );
}
[/code]
[code]
"sAjaxSource" : "server_processing.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "lgn","value":"login"} );
}
[/code]
OK?