I was writing a short function, to get data from a PHP File, the function looks like this:
async function getData(uri) {
    let promise = new Promise((resolve, reject) => {
        var xhttp;
        xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function(){
            if(this.readyState == 4 && this.status == 200){
                resolve(this.ResponseText);
            }
        }
        xhttp.open("GET", "https://coolwebsite.com/game/actions/" + uri)
        xhttp.send();
    })
    let result = await promise;
    return result;
}
However, when I try to get the data and output it in the console log, it returns a pending promise.
Promise { <state>: "pending" }
Can you help me find my error in the code, to output the real value? Thanks!
