0
I have to consume an IBGE javascript/jquery api
Click here, but I don’t know how to make the filled input data join with the link https://servicodados.ibge.gov.br/api/v1/pesquisas/{researches}. Down with my code
<script>
var valor1 = document.getElementById("teste").value;
$('#botao').click(function() {
var link ="https://servicodados.ibge.gov.br/api/v1/pesquisas/"+valor1;
$.ajax({
url: link,
type: 'GET',
dataType: 'json',
})
.done(function() {
console.log("success");
console.log(valor1);
document.getElementById("demo").innerHTML = valor1;
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
</script>
The way you did, what a mistake?
– adventistaam
You try to capture the code with
var valor = $("#idDoCampo").val()
and put it the way you did in your research– adventistaam