don't work 'fadeOut' If there is 'replaceWit

don't work 'fadeOut' If there is 'replaceWith'.?

本文关键字:there is replaceWit If work don fadeOut      更新时间:2023-09-26

当我使用fadeOutreplaceWith一起,不工作淡出。但如果我只使用fadeOut它工作。我想把它们一起使用。它在我的代码中是怎样的?

$.ajax({
        type: "POST",
        url: url,
        data: dataString,
        cache: false,
        success: function(html){
            var $html = $(html);
////////////////////////////////// here ////////////////////////////////
                    $('.ser_form #paginate input:checkbox:checked').parent().parent().fadeOut("slow");
                    $('#num_count').replaceWith($html.find('#num_count'));
                    $('tr#paginate').replaceWith($html.find('tr#paginate'));
                    $('.pagination').replaceWith($html.find('.pagination'));
////////////////////////////////// here ////////////////////////////////
        },

示例:参见

在上面的例子中,请选中row并点击DELETE查看它

这里我试着模拟你的场景http://jsfiddle.net/yY2AS/1/

你的问题我不是很清楚,总之……

在发出ajax请求之前执行

$this = $('.ser_form #paginate input:checkbox:checked').parent().parent();

然后使ajax调用(我猜ajax调用是删除和更新记录)

在成功回调do

success: function(html){
            $this.fadeOut("slow");
           //rest of the code