what I want to do is that depending on the result of my function loadOptions a label is enabled but only when the select is loaded, if it is not enabled but I do not know how to do the condition the problem is punctual I just need to know how to raise the if () {} correctly.
let cargarOpciones = (select, idSelect, valorCard, valorEstados, valorDistrito, valorProvincia ) => {
$.ajax({
type:'POST',
url: 'cargar_estados.php',
data:{
id:idSelect,
valorCard:valorCard,
valorEdo:valorEstados,
valorDistrito:valorDistrito,
valorProvincia:valorProvincia
},
dataType:'json'
})
.done(function(lista_rep1){
select.empty();
select.append('<option selected disabled value="0">Seleccione...</option>');
for (var i = 0; i < lista_rep1.length; i++) {
select.append('<option value="'+lista_rep1[i][idSelect]+'">'+lista_rep1[i][idSelect]+'</option>');
};
})
.fail(function(){
alert('error al cargar las listas');
});
}
if( cargarOpciones == true){
selectProvincia.prop( "disabled", false );
}