i just want to read a local text file and assign it to a variable. I don't see why this code doesn't work. I have already looked almost in any response on stackoverflow since yesterday and that's the only synchronous way i have found.
Anybody sees the problem ?
function readTextFile(file){
var request = new XMLHttpRequest();
request.open('GET', file);
request.onreadystatechange = function(){
console.log(request);
console.log(request.responseText);
return request.responseText;
}
}