What is the best possible way/results using a link a div and ajax to pass data without a page refresh. I'm wanting my comments and div to fade out when clicked and don't want the page to refresh. So it stays exactly where I delete the comment.
I've tried this, but its not working
<script>
function delete_(pid){
$.ajax({
type: "POST",
url: "include/post.delete.php",
data: "pid="+pid,
success: function(){
$("#comment-"+pid).remove();
}
});
}
</script>
<? if($streamitem_data['streamitem_creator']==$_SESSION['id']){
echo "<div style='cursor:pointer;' onclick=\"delete_('".$streamitem_data['streamitem_id']."');\">Delete comment</div>";
But it's not giving me the above results I need. Maybe I'm doing something wrong, but I need help if possible.