1
FORM
echo "<input type='hidden' name='idRede' value=" . $idRede . " /> ";
echo '
<label class="labelPequeno" for="idRegiao">Região</label> :
<select name="idRegiao" id="idRegiao" class="inputTextMedio required">
<option value="" selected>Escolha a Rede primeiro</option>
</select> <br/>
I have the jQuery to popular the Region:
$("#idRede").on("change", function () {
$.ajax({
url: "_scripts/_php/_buscas/buscarDadosRegioes.php",
type: "POST",
dataType: "json",
data: {
idRede: $("#idRede").val()
},
beforeSend: function() {
$("#imgCarregando").css('display','block');
},
success: function (result) {
$("#imgCarregando").css('display','none');
$('#idRegiao').find('option').remove();
if (result == null){
$("#idRegiao").append("<option value=>Sem Regiões</option>");
} else {
$("#idRegiao").append("<option value=>Escolha a Região</option>");
result.forEach(function(option){
$("#idRegiao").append("<option value=" + option["idRegiao"] + ">" + option["nome"] + "</option>")
});
}
}
});
});
The problem is that before, idRede
was a SELECT
but now it’s a input hidden
.
Some way to fire jQuery using the input hidden
?
Grateful to those who can help!
I’ve had such a problem with the Hidden fields, already tried using the
bind
?$("#idRede").bind("change", function () {
– Ricardo Pontual
and how I pass the value in Bins?
– Carlos Rocha