Ajax javascript vanilla

    const http = new XMLHttpRequest();

    const url = "ajax.php";
    
    http.open("GET", url, true);
  
    http.send();
  
    http.onreadystatechange = function() {
    
        if (this.readyState == 4 && this.status == 200) {
        
            console.log(this.responseText);
            
        }
        
    };