Skip to content

Instantly share code, notes, and snippets.

@patricekrakow
Created December 2, 2020 08:25
Show Gist options
  • Save patricekrakow/2cebf2ed5ff469c2a1c19229866a581b to your computer and use it in GitHub Desktop.
Save patricekrakow/2cebf2ed5ff469c2a1c19229866a581b to your computer and use it in GitHub Desktop.
polling-1
{
"status": "Pending..."
}
<p>
<span>Status:&nbsp;</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