let req = new XMLHttpRequest();
req.addEventListener('load', function (data) {
console.log(data)
}, false);
req.open("get", "/bar.txt", true);
req.send();
Feeling a bit perplexed at the moment, I can't seem to figure out what's going wrong. Despite receiving a HTTP status code of 200 and seeing the file content in the response, the value of data
is showing an XHR object with no responseText
and a response length of 0. The file in question is just a plain text file. As a test, I even tried changing it to a .json file to see if that made any difference.