Jquery 隐藏块后隐藏对话框

Jquery 隐藏块后隐藏对话框,jquery,ajax,symfony,Jquery,Ajax,Symfony,我有一个用ajax删除数据的脚本。单击删除链接后,将显示一个确认框 当我确认时,该框被隐藏,之后,包含已删除数据的div也被隐藏 我希望先隐藏包含已删除数据的div,然后隐藏该框 // this div will be hidden <div id="remove-item{{entity.id}}" > <a class="fa fa-trash-o fa-fw fa-2x remove_item" href data-entity-id="{{ entity.i

我有一个用ajax删除数据的脚本。单击删除链接后,将显示一个确认框

当我确认时,该框被隐藏,之后,包含已删除数据的div也被隐藏

我希望先隐藏包含已删除数据的div,然后隐藏该框

// this div will be hidden
<div id="remove-item{{entity.id}}" >

    <a class="fa fa-trash-o fa-fw fa-2x  remove_item" href data-entity-id="{{ entity.id }}">
               </a>

</div>
<script>
    $(document).ready(function () {
        $(".remove_item").click(function () {
            var entityId = $(this).attr('data-entity-id'); //
            var removeItem = '#remove-item-' + entityId; // the div
            bootbox.dialog({
                title: '<i class="fa fa-exclamation-triangle" style="color: brown"></i> Confirm',
                message: 'Delete ?',
                className: 'my-class',
                buttons: {
                    cancel:{
                        className: 'btn btn-default',
                        label: 'Close'
                    },
                    success: {
                        className: 'fa fa-trash-o btn btn-danger',
                        label: ' Delete',
                        callback: function(){

                        $.ajax({
                           type: 'POST',
                           dataType: 'json',
                           url: Routing.generate('travel_delete_ajax', {'id': entityId }),
                           success: function () {
                              $(removeItem).hide(); // hide the div
                           }
                    });
                        }
                    }
                }
            });
            return false;
        });
    });
</script>
//此div将被隐藏
$(文档).ready(函数(){
$(“.remove_item”)。单击(函数(){
var entityId=$(this.attr('data-entity-id')//
var removietem='#remove item-'+entityId;//div
bootbox.dialog({
标题:“确认”,
消息:“删除?”,
类名:“我的类”,
按钮:{
取消:{
类名:“btn btn默认值”,
标签:“关闭”
},
成功:{
类名:“fa-fa-trash-o btn btn danger”,
标签:“删除”,
回调:函数(){
$.ajax({
键入:“POST”,
数据类型:“json”,
url:Routing.generate('travel\u delete\u ajax',{'id':entityId}),
成功:函数(){
$(removietem.hide();//隐藏div
}
});
}
}
}
});
返回false;
});
});
在打开对话框之前隐藏div:

    $(".remove_item").click(function () {
         var entityId = $(this).attr('data-entity-id'); 
         var removeItem = '#remove-item-' + entityId; 

         $(removeItem).hide(); // <-- here

         bootbox.dialog({

         // <snip...>

         });
     });
$(“.remove_item”)。单击(函数(){
var entityId=$(this.attr('data-entity-id');
var removietem='#remove item-'+entityId;

$(removeItem).hide();//在ajax查询成功后无法隐藏div吗?