In the jQuery callback, ajax "this" is a reference to the parameters used in the ajax request. This is not a reference to a DOM element.
First you need to grab the "outer" $ (this) :
$('.agree').live("click", function(){
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;
});
source
share