JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="hae()">Vitsi!</button>
<p id="joke">
</p>
JavaScript
var url = "https://api.icndb.com/jokes/random"
var http = new XMLHttpRequest()
http.onreadystatechange = function() {
if (this.readyState != 4 || this.status != 200) {
return
}
response = JSON.parse(this.responseText)
document.getElementById("joke").innerHTML = response.value.joke
}
function hae() {
http.open("GET", url)
http.send()
}