I know there are a lot of questions on this topic but I could not find one that worked for me. I have comments listed on a blog post, and I want to be able to delete a comment without refreshing the page.
$(document).ready(function(){
$('button.cm$cm_id').click(function(){
$.post(\"/admin-location/delete.php?cid=\"+$cm_id, {
}, function(response){
$('#comment_$cm_id').remove();
});
});
});
And I have this as my comment box (as a reference to above)
<div class='commentbox' id='comment_$cm_id'>comment here...<div class='deletecomm'><button class='cm$cm_id deletecm'><img src='/images/pixel-vfl73.gif' alt='' /></button></div></div>
The comment is deleted from the database using my send-post.php page, but the div does not remove. If I reload the page, it is gone. Any ideas??