I have an api that returns a json whose format is as follows:
{
"id": 255,
"texto": "En un lugar de la mancha",
"categories": []
}
From an HTML I try to get one of the multiple phrases of the API in the phrase variable with the following script and then replace the headers with the phrase.
<script>
jQuery.get("direccionapi", (Response) => {
var frase = Response.texto;
$('h2').text(frase);
})
</script>
I do not get any type of result does not change the value of the header h2. But if I look at the firefox console it appears to me that it has done the GET. In "Response payload" appears the json of the api.
Thanks for the help