javascript ajax 调用因 HTML5 中的离线缓存而失败。我已经在没有缓存 HTML5 应用程序的情况下进行了测试,并且运行良好。关于这个问题有什么想法吗?
提前致谢。
JavaScript 片段:
function getData(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
alert(this.responseText);
}else if (this.readyState === 4 && this.status !== 200){
alert("alert");
}
}
xmlhttp.open("GET", serviceURL , true);
xmlhttp.setRequestHeader('Accept', 'application/json', 'text/javascript');
xmlhttp.setRequestHeader('Content-Type', 'application/json', 'charset=utf-8');
xmlhttp.send('');
}
最佳答案
我不知道你的 list 文件中有什么。
但如果此标签不存在,请添加
NETWORK:
# Do Not Cache these Files
*
如果不存在,那么您的 ajax 调用将会失败。
关于javascript ajax 缓存后不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18779611/