Created
December 2, 2020 08:25
-
-
Save patricekrakow/2cebf2ed5ff469c2a1c19229866a581b to your computer and use it in GitHub Desktop.
polling-1
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
{ | |
"status": "Pending..." | |
} |
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
<p> | |
<span>Status: </span> | |
<span id=spnStatus></span> | |
</p> | |
<script> | |
let spnStatus = document.getElementById("spnStatus"); | |
spnStatus.textContent = "Nihil"; | |
setInterval(async function(){ | |
const response = await fetch('/data.json',{ | |
"pragma": "no-cache", | |
"cache-control": "no-cache" | |
}); | |
const json = await response.json(); | |
spnStatus.textContent = json.status; | |
}, 1000); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment