在jQuery ajax回调中,“ this”是对ajax请求中使用的选项的引用。它不是对DOM元素的引用。
您需要首先捕获“外部” $(this) :
$('.agree').live("click", function(){ // use live for binding of ajax results var id=($(this).attr('comment_id')); var $this = $(this); $.ajax({ type: "POST", url: "includes/ajax.php?request=agree&id="+id, success: function(response) { $this.append('hihi'); } }); return false; });


