I'm trying to perform a delete of a forum comment using Jquery AJAX and PHP(codeigniter) with Datamapper but for some reason no matter what I do nothing happens when I click delete.
If anyone can see the problem that'd be great.
Jquery =
$('button.delete').on('click', function(event) {
console.log('derp');
// var comment = $(this).parent('.comment').attr('id');
// $.post('actions/delete_comment/'+comment);
});
forum post php =
<li class="comment" id="<?=$comment->id ?>">
<img src="assets/img/avatars/<?=$comment->user.'.jpg' ?>">
<p class="username"><?=$comment->user ?></p><p class="commenttime"><?=$comment->date ?></p><br>
<p><?=$comment->contents ?></p>
<button class="delete">Delete</button>
</li>
delete php =
public function delete_comment($id){
$comments = new Forum_comment;
$comments->get_where(array('id' => $id));
$comments->delete();
}