I am trying to implement an asynchronous function in my code and finally got it to actually wait properly, however, after waiting it seems to just stop.
function onLoad() {
    fillTechOptions();
}
function getData() {
    return new Promise(resolve => {
    // var XMLHttpReqeust = require("xmlhttprequest").XMLHttpReqeust;
    xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        if ( xhr.readyState == xhr.DONE && xhr.status == 200 ) {
            var dataset = xhr.responseText
            dataset = JSON.parse(dataset);
            console.log(dataset.recordset);
            data2 = dataset.recordset;
            
        }
        // if (xhr.readyState == 2){
            // xhr.responseType = 'json';
        // }
    };
    xhr.open('GET', 'http:localhost:5000/data', true);
    xhr.withCredentials = false;
    xhr.send();
    });
}
async function fillTechOptions() {
    alert("ran function");
    await getData();
    alert("continuing");
    var techSkills = ['All Skills'];
    for(var x = 0; x < data2; x++){
        techSkills.push(data2.SkillName);
    };
    select = document.getElementById('techSkillsSelectID');
    for (var i = 0; i<techSkills; i++){
        var opt = document.createElement('option');
        opt.value = techSkills[i];
        opt.innerHTML = techSkills[i];
        select.appendChild(opt);
    };
}onload() runs once the HTML body loads, which calls the function that is supposed to wait. I get the first alert that the function runs, then a second later my dataset appears in the console, then it just stops. I never get the second alert. Any ideas why this is happening?
 
     
    