I’ve a jQuery datatables plugin which does the following,
<tr>
<th>Id</th>
<th>Datee</th>
<th>Delete</th>
</tr>
$('#data').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "userlist.php",
"aoColumns": [
null,
null,
{
"mDataProp": null,
"sDefaultContent": '<a href="delete.php?action=activate&">DEL</a>'
}
]
} );
So what i’m doing here is that i’m getting data using server side processing and adding an additionalm column with link to delete the record.
Now I want id=<> for that particular record to be added at the end of & in a href as
a href="delete.php?action=activate&id=<<first column value> .
Also i want to convert MySQL date to PHP date for second column.
How can this be done ?
Thanks.
Try this: Modify Ricardo’s answer as follows:
EDIT: You don’t need to have the
idadded to the href attribute of the link when the table is rendered in HTML. The following code will call thedelete.phpscript via ajax and will pass the value ofidto that script.(You will then need to update the displayed datatable as well somehow – there are API functions for this: Delete a row of a datatable).
UPDATE: Another option is to do the following: