私のテーブルにはデータベースからの結果があり、テーブル内のリンクをクリックして削除すると、ページをリロードせずにテーブルを更新しようとしています。以下のコードでは機能しますが、別のリンクをクリックできるようにするには、ページ全体を更新する必要があります。立ち往生!!
$(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
///////////////////////
});