var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(r) {
if ( xhr.readyState == 4 ) {
console.log(xhr.responseText);
}
});
xhr.open('GET', 'https://example.org/');
xhr.send();
new XMLHttpRequest
- createXMLHttpRequest
objectonreadystatechange
- handle request processingexample.org/
- send request to this URLreadyState == 4
- request has been executedconsole.log(xhr.responseText)
- place your code to process response here'GET'
- use GET method for requestxhr.send()
- send the request
link_youtube: https://youtu.be/olEr-qrnul4