I am utilizing the datatables jQuery plug-in for the archive on my web form. My JavaScript is as follows:
<script type="text/javascript" language="javascript" src="js/jquery.js"</script><script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script><script type="text/javascript" language="javascript" src="jquery-ui.js"</script><script type="text/javascript" language="javascript">$(document).ready(function() {var dataTable = $('#employee-grid').DataTable( {"scrollY": 500,"scrollX": true,"processing": true,"serverSide": true,"ajax":{url :"employee-grid-data.php", // json datasourcetype: "post", // method , by default geterror: function(){ // error handling$(".employee-grid-error").html("");$("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');$("#employee-grid_processing").css("display","none");}}});});</script>
The table is working perfectly. The issue is, I want to put a hyperlink:
`<a href="admin_change_details.php?changeid=' . $row['change_id'] . '"title=Details>' . $row['change_id'] . '</a>`
on the table data in the "Change ID" field so the user can view more details. The JSON datastore file is as follows:
<?phpinclude 'config.php'; $requestData= $_REQUEST;$columns = array( 0 =>'change_id', 1 =>'customer_name', 2 => 'change_requestor', 3=> 'date_cr_raised', 4=> 'person_to_complete_change', 5=> 'cpm_ticket', 6=> 'out_of_hours', 7=> 'category_of_change', 8=> 'requestor_impact', 9=> '', 10=> 'approval_disposition', 11=> 'approval_date', 12=> 'approval_impact', 13=> 'approval_name', 14=> 'approval_expiry_date', 15=> 'status_requested', 16=> 'date_status_requested', 17=> '', 18=> 'review_change_success', 19=> 'review_change_date', 20=> 'review_nable', 21=> 'review_date', 22=> 'review_by', 23=> '', 24=> 'closed', 25=> 'closed_by', 26=> 'closed_date');$sql = "SELECT * ";$sql.=" FROM change_request_tbl";$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get data");$totalData = mysqli_num_rows($query);$totalFiltered = $totalData; $sql = "SELECT * ";$sql.=" FROM change_request_tbl WHERE 1=1";if( !empty($requestData['search']['value']) ) { $sql.=" AND ( change_id LIKE '".$requestData['search']['value']."%'"; $sql.=" OR customer_name LIKE '".$requestData['search']['value']."%'"; $sql.=" OR change_requestor LIKE '".$requestData['search']['value']."%'"; $sql.=" OR date_cr_raised LIKE '".$requestData['search']['value']."%'"; $sql.=" OR person_to_complete_change LIKE '".$requestData['search']['value']."%'"; $sql.=" OR cpm_ticket LIKE '".$requestData['search']['value']."%'"; $sql.=" OR out_of_hours LIKE '".$requestData['search']['value']."%'"; $sql.=" OR category_of_change LIKE '".$requestData['search']['value']."%'"; $sql.=" OR requestor_impact LIKE '".$requestData['search']['value']."%'"; $sql.=" OR approval_disposition LIKE '".$requestData['search']['value']."%'"; $sql.=" OR approval_impact LIKE '".$requestData['search']['value']."%'"; $sql.=" OR approval_name LIKE '".$requestData['search']['value']."%'"; $sql.=" OR approval_date LIKE '".$requestData['search']['value']."%'"; $sql.=" OR approval_expiry_date LIKE '".$requestData['search']['value']."%'"; $sql.=" OR status_requested LIKE '".$requestData['search']['value']."%'"; $sql.=" OR date_status_requested LIKE '".$requestData['search']['value']."%'"; $sql.=" OR review_date LIKE '".$requestData['search']['value']."%'"; $sql.=" OR review_change_date LIKE '".$requestData['search']['value']."%'"; $sql.=" OR review_by LIKE '".$requestData['search']['value']."%'"; $sql.=" OR review_change_success LIKE '".$requestData['search']['value']."%'"; $sql.=" OR review_nable LIKE '".$requestData['search']['value']."%'"; $sql.=" OR closed LIKE '".$requestData['search']['value']."%'"; $sql.=" OR closed_by LIKE '".$requestData['search']['value']."%'"; $sql.=" OR closed_date LIKE '".$requestData['search']['value']."%' )";}$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get data");$totalFiltered = mysqli_num_rows($query); $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]."".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']."";$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get data");$data = array();while( $row=mysqli_fetch_array($query) ) { $nestedData=array(); $nestedData[] = $row["change_id"]; $nestedData[] = $row["customer_name"]; $nestedData[] = $row["change_requestor"]; $nestedData[] = $row["date_cr_raised"]; $nestedData[] = $row["person_to_complete_change"]; $nestedData[] = $row["cpm_ticket"]; $nestedData[] = $row["out_of_hours"]; $nestedData[] = $row["category_of_change"]; $nestedData[] = $row["requestor_impact"]; $nestedData[] = $row[""]; $nestedData[] = $row["approval_disposition"]; $nestedData[] = $row["approval_date"]; $nestedData[] = $row["approval_impact"]; $nestedData[] = $row["approval_name"]; $nestedData[] = $row["approval_expiry_date"]; $nestedData[] = $row["status_requested"]; $nestedData[] = $row["date_status_requested"]; $nestedData[] = $row[""]; $nestedData[] = $row["review_change_success"]; $nestedData[] = $row["review_change_date"]; $nestedData[] = $row["review_nable"]; $nestedData[] = $row["review_date"]; $nestedData[] = $row["review_by"]; $nestedData[] = $row[""]; $nestedData[] = $row["closed"]; $nestedData[] = $row["closed_by"]; $nestedData[] = $row["closed_date"]; $data[] = $nestedData;}$json_data = array("draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data );echo json_encode($json_data); // send data as json format?>
My question is, am I able to generate a hyperlink through the JSON datastore, or do I have to utilize JavaScript?