I have to consume an api in javascript / jquery from IBGE
Click here , but I do not know how to make the data of the input filled together with the link link {searches}. Below 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>