I want to delete the row of the table after the ajax call. Here my code:
function getResultsMsr(action, msrDel) {
if(action == 'search') {
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"ajax": "testing_ajax.php",
"columnDefs": [
{
"aTargets":[7], // this your column of action
"mData": null,
"mRender": function(data, type, full){
var rowId= full[6];
return '<td id="row'+msrDel+'"><a href="javascript: void(0);" onclick="removeRow('+rowId+');" >Delete</a>
}
}
]
} );
Here is my delete function what I have tried for delete the row :
function removeRow(msrDel){
var parent = $(this).parent().parent();
$.ajax({
url: 'getResult.php',
type: 'POST',
data: "id="+msrDel
}).done(function(result_data){
parent.fadeOut('slow', function() {$(this).remove();});
});
return false;
}
function removeRow(msrDel){
var oTable = $('#example').dataTable();
var parent = $(this).parent().parent();
$.ajax({
url: 'getResult.php',
type: 'POST',
data: {
formName:'afscpMsr',
action:'delete',
delmsr: msrDel
}
}).done(function(result_data){
// parent.fadeOut('slow', function() {$(this).remove();});
oTable.fnDeleteRow( $('#example tbody tr:eq(0)')[0] );
});
return false;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.