Есть функция, где я пытаюсь записать в переменную данные текстового файла с сервера
function loadModel(){
var cookiePath = readCookie('modelID');
var modelPath = "../modelbase/php_base/models/"+cookiePath+".zedit";
var rawFile = new XMLHttpRequest();
rawFile.open("GET", modelPath, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var modelText = rawFile.responseText;
alert(modelText);
}
}
}
rawFile.send(null);
}
Но при попытке считывания в консоль получаю предупреждение (на строке rawFile.open...):
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Есть ли какой-то способ получить данные из нужного файла?