2
I am with a Json of cities in the following structure:
var cidade = [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
"Capixaba",
"Cruzeiro do Sul",
"Epitaciolândia",
"Feijó",
"Jordão",
"Mâncio Lima",
"Manoel Urbano",
"Marechal Thaumaturgo",
"Plácido de Castro",
"Porto Acre",
"Porto Walter",
"Rio Branco",
"Rodrigues Alves",
"Santa Rosa do Purus",
"Sena Madureira",
"Senador Guiomard",
"Tarauacá",
"Xapuri"
]
},
{
"sigla": "AL",
"nome": "Alagoas",
"cidades": [
"Água Branca",
"Anadia",
"Arapiraca",
"Atalaia"....
It has a select that at the moment the State is selected I catch the acronym as follows:
$('#estado').change(function(){
var estado = $(this).val();
/*foreach inicia aqui
})
})
I am trying to take all cities and play within a select by the acronym that is stored in the variable state, however I am not succeeding...someone would have a solution to this case. Thank you
I just made a little adaptation to my reality and it worked perfectly.
– Betini O. Heleno
Cool man, success there!
– LeAndrade