我需要在成功调用 ajax 后删除表格行,但不确定该怎么做。这是我的代码:
function closelead(rowid){
var rowid1 = rowid;
alert(rowid1);
var parent = $(this).parent();
$.ajax({
type: "POST",
url: "ajax/close.php",
data: "rowid="+ rowid1,
success: function(html){
}
});
}
<tr><td><input type="button" onclick="closelead(<?php echo $leadlist['ID'];?>)" value="Close" class="searchbutton" /></td></tr>
最佳答案
您可以使用 closest()找出包含单击按钮的行并使用 remove()删除按钮行。
success: function(html){
$(this).closest('tr').remove();
}
关于php - jQuery 删除 $.ajax 成功的表行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13697154/