Can you explain to me why the jQuery multipleSelect () class does not update the received values via JSON ?
For example, when I select a state, in my other selection field, the related cities of that state are filtered. When I linko the jQuery in the cities field, the field is only blank, that is, it only receives the value of when the page is loaded, which in this case is in white.
I want to know how I retrieve the state and play the dynamically filtered cities, and where do I link to my cities field?
$('select[name=uf]').on('change', function () {
var uf = $(this).val();
$.get('/judicial/get-cidades/' + uf, function (busca) {
$('select[id=comarca_id]').empty();
$('select[id=comarca_id]').append('<option value=""> </option>');
$.each(busca, function (key, value) {
$('select[id=comarca_id]').append('<option value=' + value.name + '>' + value.name + '</option>');
});
});
});
$(document).ready(function(){
$('select[name=comarca_id]').multiselect({
numberDisplayed: 0,
includeSelectAllOption: true,
allSelectedText: 'Todos',
nonSelectedText: 'Selecione',
nSelectedText: 'Selecionado',
selectAllText: 'Todos',
});
});
Here is the link where I got this jQuery .