Learn JavaScript - Requests Cheatsheet - Codecademy
Learn JavaScript - Requests Cheatsheet - Codecademy
Learn JavaScript - Requests Cheatsheet - Codecademy
Requests
Asynchronous calls with XMLHttpRequest
AJAX enables HTTP requests to be made not only
during the load time of a web page but also anytime const xhr = new XMLHttpRequest();
after a page initially loads. This allows adding dynamic xhr.open('GET',
behavior to a webpage. This is essential for giving a 'mysite.com/api/getjson');
good user experience without reloading the webpage
for transferring data to and from the web server.
The XMLHttpRequest (XHR) web API provides the ability
to make the actual asynchronous request and uses
AJAX to handle the data from the request.
The given code block is a basic example of how an
HTTP GET request is made to the specified URL.
req.send();