Skip to content

Instantly share code, notes, and snippets.

@jbussdieker
Created November 22, 2016 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbussdieker/2161938edd4e840378f91f34b2caca89 to your computer and use it in GitHub Desktop.
Save jbussdieker/2161938edd4e840378f91f34b2caca89 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Home</title>
<style>
body {
background-color: white;
}
</style>
</head>
<script type="text/javascript">
function doRequest() {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200) {
console.log("GOOD");
document.getElementById("status").innerHTML = "GOOD";
document.body.style.backgroundColor = "green";
} else {
console.log("BAD");
document.getElementById("status").innerHTML = "BAD";
document.body.style.backgroundColor = "red";
}
}
}
request.timeout = 500;
request.open("get", "", true);
request.send(null);
}
setInterval(doRequest, 1000);
</script>
<body>
<span id="status">Loading...</span>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment