There is a function that should return the text from the file.
//Функция возращает текст из файла nameTextFile function fileProcess() { var xhr = new XMLHttpRequest(); xhr.open('GET', nameTextFile, true); xhr.send(); xhr.onreadystatechange = function () { if (this.readyState != 4) return; // по окончании запроса доступны: // status, statusText // responseText, responseXML (при content-type: text/xml) if (this.status != 200) { // обработать ошибку alert('ошибка: ' + (this.status ? this.statusText : 'запрос не удался')); return; } // получить результат из this.responseText или this.responseXML } //alert('готово'); DataFirm = (xhr.responseText); return DataFirm;; } So, it returns empty, but if you turn on the alert before the responseText line, then everything returns normally. What could be the reason? I understand the whole thing is that the alert stops the code and waits for the OK to be pressed, at this time all that is needed is loaded. But I don’t need an alert at all.
truechange tofalseinopen(). - Visman