在我的表中,我有来自数据库的结果,当我单击表中的链接将其删除时,我试图在不重新加载页面的情况下刷新表。在下面的代码中它可以工作,但我仍然需要刷新整个页面才能点击另一个链接。卡住!!
$(document).ready(function(){
$('td a').click(function(){
//alert($(this).attr('id'));
var id =$(this).attr('id');
var img_name =$(this).attr('name');
//alert(img_name);
$.ajax({
type: "POST",
url: "remove.php",
cache: false,
data: "id="+ id +"&img_name="+ img_name,
success: function(message){
alert(message);
}
});
var url = "delete.inc.php"; //create random number
setTimeout(function() {
$("#table").load(url+" #table>*");
}, 1000); //wait one second to run function
///////////////////////
});