Reputation: 207
I need to recreate the multiselect in "Local" after "Empresa" ajax response with this data response. I put the information in "Local" select but I am not able to recreate the "Local" multiselect.
$.ajax({
url: '/ajaxrequests/requestlocals',
type: 'POST', dataType: 'json',
data: {empresas:empresas},
success: function(retorno){
console.log(retorno);
$('#ajax_local').html("");
$.each(retorno, function (valor, chave) {
$('#ajax_local').append($('<option>', {
value: valor,
text : chave
}));
});
$('#ajax_local').multiselect();
}
});
Upvotes: 0
Views: 682
Reputation: 13146
Try to destroy it first;
$("#ajax_local").multiselect('destroy');
$("#ajax_local").multiselect();
Upvotes: 1