There is a function where I try to write to a variable the data of a text file from the server
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); } But when I try to read to the console, I get a warning (on the rawFile.open line ...):
It is a synchronous XMLHttpRequest on the user's experience. For more help, check https://xhr.spec.whatwg.org/ .
Is there any way to get data from the right file?