JSFiddle - React, Tailwind, and code Playground
HTML
<h1>
Js Advanced: Ajax
</h1>
<button>Change conte</button>
JavaScript
function req() {
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if(this.readyState == 4 && this.statusCode === 400) {
console.log(this.responseText);
}
}
xhr.open('GET','https://www.w3schools.com/xml/ajax_info.txt')
}
req();