const HTTP = new XMLHttpRequest();
// const URL = "https://dog.ceo/api/breed/labrador/images/random";
const URL = "https://marchouben.nl/nl/Jihad.JPG";

HTTP.addEventListener('readystatechange', function(){
  if (HTTP.readyState==4 && HTTP.status==200){
    verwerk(HTTP.responseText);
  }
  console.log("readyState: " + HTTP.readyState)
});

HTTP.open("GET", URL, true);
HTTP.send();

function verwerk(input){
    let img = document.createElement("img");
    input = JSON.parse(input);
    img.setAttribute('src', input.message);
    document.body.appendChild(img);
}
