可拆卸的盒子移除第一个盒子,而不是一个单击

时间:2016-08-04 19:07:23

标签: javascript php ajax

目前我有一个while循环设置来显示页面上的符号。单击“x”删除一个时,它总是从页面中删除第一个。后端仍然删除正确的条目,但我必须刷新才能看到这一点。如何防止错误的盒子出现尿布以避免混淆?

HTML / PHP while循环

while ($commentRow = mysql_fetch_array($woComments)) { ?>
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-info panel-dismissable" id="panel-dismissable">
                        <div class="panel-heading">
                        <button type="button" class="close" data-target="#panel-dismissable" data-dismiss="alert" onClick="DelNotation(this, <?php echo $commentRow['CommentsID']; ?>);"> <span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                            Notation on <?php echo $commentRow['Date']; ?>
                        </div>
                        <div class="panel-body">
                            <p><?php echo $commentRow['Comment']; ?></p>
                        </div>
                    </div>
                </div>
                <!-- /.col-lg-4 -->
            </div>
            <!-- /.row -->
<?php }

的Ajax

     <!-- Close Notation -->
    <script>
function DelNotation(button, wo)
{
    var Comment = $(button).closest(".row").find(".panel-dismissable").val();
    jQuery.ajax({
        type: "POST",
        url: "functions/closeNotation.php",
        data: {wo: wo},
        cache: false,
        success: function(response)
        {
            //alert("Your notation has been removed from this work order");
        }
    });
}


 </script>

0 个答案:

没有答案