I have a datatable that has a delete button, when click the delete button i want to pass the values in the row to my sever to delete and also delete in on the row when the server responds with a success. How can i achieve getting the value of the row to the onclick function and also the tr element so i can delete it.
this is my present code:
model.initDataTable = function () {
$('#datatables').DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "http://localhost:8080/admin/query/fibre",
"data": function ( data ) {
//process data before sent to server.
}},
"columns": [
{ "data": "id", "name" : "ID", "title" : "ID" },
{ "data": "name", "name" : "Name" , "title" : "Name"},
{ "class":"",
"orderable": false,
"data": null,
"defaultContent": "<button id='dltBtn' type=\"button\" class=\"btn purple-gradient btn-sm\">Delete</button>"},
{ "class":"",
"orderable": false,
"data": null,
"defaultContent": "<button id='viewBtn' type=\"button\" class=\"btn purple-gradient btn-sm\">Delete</button>"},
]
} );
$('#datatables tbody').on( 'click', '#dltBtn', function () {
} );
};
