If I am correct, "A" in "AJAX" means sending a HTTP request asynchronously without waiting for a HTTP response.
I learn that we can send an asynchronous HTTP request by XMLHttpRequest
, for example:
function handleButtonPress(e) {
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = handleResponse;
httpRequest.open("GET", e.target.innerHTML + ".html");
httpRequest.send();
}
How can we send a HTTP request synchronously?