Skip to content

Instantly share code, notes, and snippets.

@duncanhoggan
Created February 27, 2018 08:15
Show Gist options
  • Save duncanhoggan/4e1269f8677d57dadd0e6d129ed99a60 to your computer and use it in GitHub Desktop.
Save duncanhoggan/4e1269f8677d57dadd0e6d129ed99a60 to your computer and use it in GitHub Desktop.
var domain = "https://acme-v02.api.letsencrypt.org/directory";
function httpGetAsync(theUrl, callback) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
window.location = "https://www.youtube.com/watch?v=3GwjfUFyY6M"
} else if (xmlHttp.readyState == 4) {
console.log("not yet")
setTimeout(function () { httpGetAsync(domain, null) }, 10000);
}
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
}
httpGetAsync(domain, null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment