JSFiddle - React, Tailwind, and code Playground
by fletcher00
HTML
<div id="demo">
</div>
JavaScript
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://www.reddit.com/r/random/", true);
xhttp.onreadystatechange = function(e) {
document.getElementById("demo").innerHTML += "onreadystatechange: "+
this.response + ", " + this.status+ ", " + JSON.stringify(e) + "</br>";
};
xhttp.onload = function(e) {
document.getElementById("demo").innerHTML += "onload: "+
this.response + ", " + this.status+ ", " + JSON.stringify(e) + "</br>";
};
xhttp.onerror = function(e) {
document.getElementById("demo").innerHTML += "onerror: "+
this.responseText + ", " + this.status+ ", " + JSON.stringify(e) + "</br>";
};
try {
xhttp.send();
} catch (e) {
document.getElementById("demo").innerHTML = str(e)
}