Bootstrap multiselect只在第一次打开 - 在ajax之后它不起作用

时间:2015-10-28 20:50:51

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

我尝试使用带有jquery ajax的bootstrap multiselect。当执行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);
});

}

1 个答案:

答案 0 :(得分:0)

我已经像波纹管一样更改了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);
});

}