Javascript GET方法无法返回资源
我在WAMP中托管一个网页,并在Chrome开发者控制台中不断收到此错误 得到http://localhost/surveys/Internet.json survey.js:368 my survey.js第368行在此函数中`Javascript GET方法无法返回资源,javascript,http,http-headers,xmlhttprequest,wamp,Javascript,Http,Http Headers,Xmlhttprequest,Wamp,我在WAMP中托管一个网页,并在Chrome开发者控制台中不断收到此错误 得到http://localhost/surveys/Internet.json survey.js:368 my survey.js第368行在此函数中` function loadJSON(key,json){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){
function loadJSON(key,json){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var obj = xhr.responseText;
localStorage.setItem(key,obj);
}
}
};
xhr.open("GET", json, true);
xhr.send(); // <<-------------------------- line 368
}
我不知道发生了什么事。我最近试图重新安装wamp,希望它只是与另一个应用程序冲突,但它没有解决任何问题。
任何帮助都会很好。这是缓存清单文件中的一个问题
必须注意的是,在清单中,这些文件需要互联网连接才能使用,而在我的情况下,我没有
CACHE MANIFEST
#Files to store on application cache
NETWORK
#Files that would require internet connection to access
在文本中找不到实际的错误消息,如果找不到错误消息,请在Try/Catch块中包含xhr.send调用。把结果贴在这里。另外,请尝试用尽可能少的代码隔离问题,并将该代码段发布在Gist/Pastebin/Plunker/中。