[英]How to fetch data row by row from mysql table, queries coded in php, using jquery (AJAX)?
[英]How to remove the row of the data table using ajax jquery
我想在ajax调用后删除表的行。 这是我的代码:
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>
}
}
]
} );
这是我尝试删除行的删除功能:
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;
}
函数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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.