function ajaxGet(url, success, failure) {
    let xhr = new XMLHttpRequest();
    let verb = "get";

    xhr.open(verb, url);

    xhr.addEventListener("load", res => {
        // this will run when the request completes
        if (xhr.status >= 200 && xhr.status < 300) {
            success(xhr.responseText);
        } else {
            failure(xhr.statusText);
        }
    });

    xhr.send();
}
// success and failure are "callback functions"
success and failure are "callback functions"
success and failure are " callback functions "
function ajaxGet(url, success, failure) {
    let xhr = new XMLHttpRequest();
    let verb = "get";
    xhr.open(verb, url);
    xhr.addEventListener("load", res => {
        if (xhr.status >= 200 && xhr.status < 300) {
            success(xhr.responseText);
        } else {
            failure(xhr.statusText);
        }
    });
    xhr.send();
}
function ajaxGet ( url , success , failure ) { let xhr = new XMLHttpRequest ( ) ; let verb = "get" ; xhr . open ( verb , url ) ; xhr . addEventListener ( "load" , res => { if ( xhr . status >= 200 && xhr . status < 300 ) { success ( xhr . responseText ) ; } else { failure ( xhr . statusText ) ; } } ) ; xhr . send ( ) ; }
success and failure are "callback functions"
success and failure are " callback functions "
// this will run when the request completes