【发布时间】:2013-11-15 07:24:57
【问题描述】:
我无法查看新的搜索结果,因为它们已在数据库中更新。仅使用 Internet Explorer 8。我尝试刷新页面,但没有任何效果。 Chrome 和 Firefox 运行良好。
我可以通过选择“检查存储页面的新版本:每次访问网页”来临时解决此问题。但是,当我将它投入生产时,这意味着它不适用于使用 IE 8 9 或 10 的最终用户。
感谢任何有用的提示。提前致谢。
这是我已经尝试过的:
<script> type=“text/javascript" src="js/jquery-1.9.1.min.js?new=yes"></script>
$(document).ready(function () {
//http://stackoverflow.com/questions/217957/how-to-print-debug-messages-in-the-google-chrome-javascript-console/2757552#2757552
if (!window.console) console = {};
console.log = console.log || function () {};
console.dir = console.dir || function () {};
//listen for keyup on the field
$("#searchField").keyup(function () {
//get and trim the value
var field = $(this).val();
field = $.trim(field)
//if blank, nuke results and leave early
if (field == "") {
$("#results").html("");
return;
}
console.log("searching for " + field);
$.getJSON("cfc/test.cfc?returnformat=json&method=search", {
"search": field
}, function (res, code) {
var s = "<table width='1000' class='gridtable' name='table1' border='1'><tr><th width='40'>Attuid</th><th width='80'>Device</th><th width='55'>Region</th><th width='140'>Problem</th><th width='160'>Description</th><th width='120'>Resolution</th> <th width='180'>Resolution Description</th><th width='40'>Agent</th><th width='140'>Timestamp</th></tr>";
s += "";
for (var i = 0; i < res.table_demo.length; i++) {
s += "<tr><td width='42'>" + res.table_demo[i].pa_uid +
"</td><td width='80'>" + res.table_demo[i].pa_device +
"</td><td width='55'>" + res.table_demo[i].pa_region +
"</td><td width='140'> " + res.table_demo[i].pa_problem +
"</td><td width='160'> " + res.table_demo[i].pa_description +
"</td><td width='120'>" + res.table_demo[i].pa_resolution +
"</td><td width='180'>" + res.table_demo[i].pa_rdescription +
"</td><td width='42'> " + res.table_demo[i].pa_agent +
"</td><td width='140'> TimeStamp"
"</td>";
s += "</tr>";
}
s += "</table>";
$("#results").html(s);
});
});
})
【问题讨论】:
-
通过 ajaxSetup 禁用缓存,或者改用 $.ajax(首选)。
-
您是否查看过 HTTP 缓存标头? mobify.com/blog/beginners-guide-to-http-cache-headers
-
它可能只是一个剪切和粘贴错误,但这看起来不正确:
<script> type=“text/javascript" src="js/jquery-1.9.1.min.js?new=yes"></script>
标签: javascript jquery