我有一个 ajax 调用doop.php
。
function doop(){
var old = $(this).siblings('.old').html();
var new = $(this).siblings('.new').val();
$.ajax({
url: 'doop.php',
type: 'POST',
data: 'before=' + old + '&after=' + new,
success: function(resp) {
if(resp == 1) {
$(this).siblings('.old').html(new);
}
}
});
return false;
}
我的问题是$(this).siblings('.old').html(new);
生产线没有做它应该做的事情。
谢谢..所有有用的评论/答案都被投票了。
更新:问题的一半似乎是范围(感谢帮助我澄清这一点的答案),但另一半是我试图以同步方式使用 ajax。我创建了一个新帖子