The problem is that ajax calls are asynchronous. That means the response is separate from the request. You have to modify your code to handle that. You cannot (should not) make http calls synchronous.
Look at this code. It works, and you'll be able to read the response:
var req = new XMLHttpRequest();
req.open('GET', url, true);
req.onreadystatechange = function (ev) {
if (req.readyState == 4) {
alert(req.responseText);
}
};
req.send(null);