JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" onclick="sayHello();">Say Hello via AJAX</a>

JavaScript

function sayHello() {
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function() {
    if(xhr.readyState === 4 && xhr.status === 200) {  //no error
      alert(xhr.responseText);
    }
  };
  xhr.open('POST', '/echo/html/');
  xhr.send('html=Hello!');
}