Correct use of AJAX callback

With the script below the result is undefined if set to asynchronous in the open() method but works if set to synchronous.

What am I doing wrong?

var x, l, objX, returnedData, oldCSS, newCSS;

returnedData = null;

function getCSS(url, callback) {

    objX = new XMLHttpRequest();

    if (objX !== null) {

        objX.open("GET", url, false);

        objX.onreadystatechange = function () {

            //if readyState is not 4 or or status not 200 then there is a problem that needs attending
            if (objX.readyState === 4) {
                if (objX.status === 200) {

                    returnedData = objX.responseText.toString();
                    callback(returnedData);

                } else {

                    //alert('HTTP error ' + objX.status); // change to FALSE on live site
                } // end if status === 200
            } // end if readstate === 4
        };

        objX.send();

    } else {

        alert("You do not have AJAX implemented on your browser, sorry.");

    } //CS.Json.objX
}


getCSS("http://www.ultrabox-two.andywalpole.me/styles/style.css", function (result) {
    alert(result);
});

it seems to be fine now for some reason