0
$('#columns-selected').change(function(){
let menu = [];
for (i=0; i < 5; i++){
let opcao = $('#columns-selected option:selected')[i];
if (opcao){
menu.push($(opcao).val());
};
}
$.ajax({
method: 'POST',
url: base_url+'fornecedor/menuPadrao/',
dataType: 'JSON',
data: { menu: menu },
success: function(data)
{
if(!data.result == true){
alert('Ocorreu um erro tente novamente!');
}
}
});
})
Doubt/Question/Suggestion
How would you make it so that when the user selects 5, in addition to sending the 5 via ajax, disable the rest of the options in select ???
@Visiondevelopment had not seen that you wanted to disable only those that were not marked, if that’s what it is, I updated the code accordingly. if it helps you bro, please mark the answer as correct.vlw.
– MichaelCosta