【发布时间】:2013-10-28 21:49:52
【问题描述】:
我在 php 中使用 jquery ajax 执行删除记录。我想在不使用 location.reload() 函数的情况下刷新该内容。我试过了,
$("#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);
}
});
}
【问题讨论】:
-
您可以使用
$('#divSettings').html(result);,只要您的ir_display_polls.php页面返回正确的html。 -
你使用的是
this,而你应该使用result。需要用结果更新 Html -
您收到的
result是什么? html? -
删除记录后结果没有给我最新的更新.....
-
那么你必须返回最新的更新,所以它在
result。
标签: javascript php jquery html ajax