Reading issues through javascript
-
There's a function where I'm trying to record a text file on 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 in an attempt to read into the console, I get a warning.
Synchronous XMLHtpRequest 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/ ♪Is there any way to get the data from the right file?
-
Warning tells you:
"You're trying to send a synchronized xhr request. Send simultaneous The queries are no longer fashionable because the men don't like to wait."
For synchronization/asynchronousness
xhr
Third performancexhr.open
♪
You can put it in.true
or take it away.true
default).