I'm achieving a "delete comments system", a "delete div" near to each comment, but I'm stuck on how to know in which I clicked on "Delete" button after a jquery post function runs? and then how to show "deleted" word appeares in place of the last "delete" clicked on?
<script ..>
$(".click).click(function(){
$.post("do.php",{...},function(data){/* I'm here*/})
});
</script>
<?php
$result = mysql_query("select * from ...");
while($data = mysql_fetch_array($result )){
?>
<div class="comment">
..
<a href="#" class="click">Delete</a>
<input type="hidden" value="<?php echo $data[0]; ?>" cl开发者_如何学Goass="comm">
</div>
Any help will be greatfully appreciated. Salutations.
$(".click").click(function(){
    var me = this;
    $.post("do.php",{...},function(data){ alert(me); )
});
You need to grab the value of the class in your input element.
<input type="hidden" class="<?php echo $idComm; ?>"> 
Although I would put the commentId in a value attribute:
<input type="hidden" value="<?php echo $idComm; ?>" class="commentId">
Because your click function is attached to the a you will need to use jquery to get it
$(".click).click(function(){
    var parentDiv = $(this).parent();    // get parent div
    var commentId = parentDiv.find('input#commentId').val();  // get comment id 
    $.post(
       "do.php",
       { "commentId" : commentId },   // post comment id to server to extract from POST variable
       function(data, textStatus, XMLHttpRequest) {
           parentDiv.empty();       // Removes whats inside your div
           parentDiv.append('deleted')    // adds deleted inside the div
       }
   );
});
JQuery ajax makes all this simpler but I am answering the question asked
not tested so there might be typos
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论