Passing Parameters to PHP

Passing Parameters to PHP

pikaclintpikaclint Posts: 9Questions: 2Answers: 0

can you guys help me i have no idea how to pass parameters to php i read that i should use "fnServerParams" i tested it often and it doesn't work do you guys know how?

I have this testing.html which contains

Data Table

First Name Last Name
var fname = "CL%"; $( document ).ready(function() { $('#example').dataTable({ "bProcessing": true, "sAjaxSource": "testing.php", "fnServerParams": function ( aoData ) { aoData.push( { "name": "more_data", "value": fname } ); }, "aoColumns": [ { mData: 'emp_fname' }, { mData: 'emp_lname' } ] }); });

testing.php
<?php
require '../includes/connection.php';

//query
$stmt = $db->query("SELECT emp_fname,
emp_lname,
emp_no
FROM employee
WHERE emp_fname like 'AM%'");

//filter query
$data = array();
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$data[] = array('emp_fname'=>$row['emp_fname'],'emp_lname'=> $row['emp_lname']);
}
$results = array("sEcho" => 1,"iTotalRecords" => count($data),"iTotalDisplayRecords" => count($data),"aaData"=>$data);
echo json_encode($results);

<?php > ?>
This discussion has been closed.