<!DOCTYPE html>
<html lang="en-US">
<body>
<h1>JavaScript XMLHttpRequest()</h1>
<p>Click on the button to send XMLHttpRequest.</p>
<button onclick="myFunction()">Click Me</button>
<script>
function myFunction() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
};
xhttp.open("GET", "/greet.php", true);
xhttp.send();
}
</script> </body>
</html>