I can't understand why my function returns empty date. If I use REST client it returns my correct date.
function requestData(data) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url + data, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var info = xhr.responseText;
return info;
}
};
xhr.send();
}
Is anyone can explain me why I retrieve empty data?