0
I have a script where, after selecting the first select it returns me in the second select the currency referring to the country, but these countries and coins when you have special requirements are bringing me "B Snia and Herzegovina"
script js.
$(document).ready(function () {
var paises = null;
var moedas = null;
$.ajax({
type: "GET",
url: "../paises.json",
contentType: "application/json ; charset=UTF-8",
cache: false,
success: function(retorno) {
paises = retorno;
$.each(paises,function(i, pais){
$('#pais').append($('<option>', {
value: paises[i].sigla_moeda,
text: paises[i].pais
}));
});
}
});
$('#pais').change(function(){
$("#moeda").empty();
$.ajax({
type: "GET",
url: "../moedas.json",
contentType: "application/json ; charset=UTF-8",
cache: false,
success: function(retorno) {
var moedas = retorno;
$.each(moedas,function(i, moeda){
if($('#pais').val() === moedas[i].sigla){
$('#moeda').append($('<option>', {
value: moedas[i].sigla_moeda,
text: moedas[i].moeda
}));
}
});
}
});
})
thanks in advance!
Dear you saved me, thank you very much. I followed your clarification and removed the contenttype. Thanks!
– Eric de Oliveira
@Ericoliveira, would you please mark the answer as correct? Stay on the left side of the answer if you don’t know how to do it read the instructions at: https://pt.meta.stackoverflow.com/q/1078/3635
– Guilherme Nascimento