我在php中使用jquery ajax執行刪除記錄。我想在不使用location.reload()函數的情況下刷新該內容。我試過這個,使用ajax jquery刷新頁面而不使用重載功能
$("#divSettings").html(this);
但是,它不工作。在div中獲取更新內容的正確邏輯是什麼? 謝謝。
代碼:
function deletePoll(postId){
$.ajax({
type: "POST",
url: "../internal_request/ir_display_polls.php",
data: {
postId: postId
},
success: function(result) {
location.reload();
//$("#divSettings").html(this);
}
});
}
只要你的'ir_display_polls.php'頁面返回正確的html,你就可以使用'$('#divSettings')。html(result);'。 –
當您使用'result'時,您正在使用'this'。 Html需要更新結果 – rogMaHall
您收到的結果是什麼? HTML? – Lachezar