-
-
Save parzibyte/39cd8ccde05ab468bb8d14cee886d118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $btnPeticion = document.querySelector("#btnPeticion"), | |
$resultados = document.querySelector("#resultados"); | |
$btnPeticion.addEventListener("click", () => { | |
$resultados.textContent = "Cargando..."; | |
fetch("https://httpbin.org/") | |
.then(resultadoRaw => { | |
// Lo decodificamos como texto plano | |
return resultadoRaw.text(); | |
}) | |
.then(resultadoComoTexto => { | |
$resultados.textContent = resultadoComoTexto; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment