Witam.
Mam problem dotyczący, czegoś, co może zdawać się banalne. Otóż nie umiem wyciągnąć danych z funkcji.
let configURL = 'assets/config.txt';
let read = new XMLHttpRequest();
let configSource, config;
read.open('GET', configURL);
read.responseType = 'text';
read.onload = function () {
if (read.readyState === read.DONE) {
if (read.status === 200) {
configSource = read.response;
return configSource;
}
}
};
read.send(null);
// config = JSON.parse(configSource);
console.log(configSource);
Gdyby, znalazła się osoba, która by się zlitowała nade mną i mi pomogła byłbym wielce wdzięczny.
Miłego dnia.