【问题标题】:Bootstrap multiselect open only the first time - After ajax it doesn't workBootstrap 多选仅第一次打开 - ajax 后它不起作用
【发布时间】:2015-10-28 20:50:51
【问题描述】:

我尝试使用带有 jquery ajax 的引导多选。执行 ajax 时,多选按钮不起作用。你可以在这里看到问题:http://www.doyleia.com/anazitisi-ergasias 在最后一个多选中。

ajax 代码:

function runAjax(tags, contracts, educations, towns) {

$(document).ajaxStart(function(){
    $("#wait").css("display", "block");
});
$(document).ajaxComplete(function(){
    $("#wait").css("display", "none");
});
$.ajax({
    url: 'http://www.doyleia.com/anazitisi-ergasias?' + tags + '&' + contracts + '&' + educations + '&' + towns,
}).done(function(data){
    // destroy I used it because builded again the multiselect button after ajax
    $('.multi-boot-select').multiselect('destroy');
    var $html = $(data);
    //hide within that object
    $html.find('.form-for-hide').hide();
    $html.find('p.hidden').removeClass('hidden');
    // insert the object
    $('div.load-jobs').html($html);
});

}

【问题讨论】:

    标签: javascript jquery ajax multi-select bootstrap-multiselect


    【解决方案1】:

    我已经像下面这样更改了 ajax,现在它可以工作了:

    function runAjax(tags, contracts, educations, towns) {
    
    $(document).ajaxStart(function(){
        $("#wait").css("display", "block");
    });
    $(document).ajaxComplete(function(){
        $("#wait").css("display", "none");
    });
    $.ajax({
        url: 'http://www.doyleia.com/anazitisi-ergasias?' + tags + '&' + contracts + '&' + educations + '&' + towns,
    }).done(function(data){
        // destroy I used it because builded again the multiselect button after ajax
        var $html = $(data);
        //hide within that object
    
        var finalGet =  $html.find('.row-to-take');
    
        //$html.find('.form-for-hide').hide();
        $html.find('.hidden.alert.alert-danger').removeClass('hidden');
    
        // insert the object
        $('div.load-jobs').html(finalGet);
    });
    

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多