In my javascript code I have:
function getThing(){
    var url = "myhost/thing";
    var x = new XMLHttpRequest();
    x.open("GET", url, false);
    x.onload = function (){
        return x.responseText
    }
    x.send(null);
}
console.log(getThing())
And console log gives me undefined. 
What am I doing wrong?
 
    