How do I append row data to a generated link

How do I append row data to a generated link

matttonksmatttonks Posts: 1Questions: 1Answers: 0

Hi,

So I've created a table using server side processing and I need to append data from the book number row to the link in the extra column i've created.

So for example, if the books number is 5 for that row, the link needs to be href="page/book/delete-book.php?5"

Here's my code:

$('#bookTable').DataTable({
"processing": true,
"serverSide": true,
"ajax":{
url :'book-data.php',
type: "post",
error: function(){
$(".book-table-error").html("");
$("#bookTable").append('<tbody class="book-table-error"><tr><th colspan="3">No data found in the server</th>
</tr></tbody>');
}
},
"columnDefs": [{
"targets": -1,
"data": null,
"defaultContent": '<a href="page/book/delete-book.php?"><i style="color:red;" class="fa fa-fw fa-trash"></i>
</a>'
}]
});

My understanding is that I need a way to basically reference the data from my ajax request but I have no idea how

Any help would be much appreciated!

Answers

This discussion has been closed.