gpt4 book ai didi

php - jQuery 删除 $.ajax 成功的表行

转载 作者:行者123 更新时间:2023-11-30 08:55:46 28 4
gpt4 key购买 nike

我需要在成功调用 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com