I am new to AJAX, As i understood that the handler function executes when response is ready.
  xhttp.onreadystatechange = function() {
      if (this.readyState == 4 && this.status == 200) {
          document.getElementById("demo").innerHTML =
          this.responseText;
      }
   };
And then we create and send our request
xhttp.open("GET", url, true);
xhttp.send();
does it make sense to handle the response while not sending the request yet !? Thanks
