我有以下jQuery代码:
function update() {
$.get("getlatest.php", {
id: $.cookie('last_post_id')
}, function (response) {
$('#board_posts').prepend(response);
$('.incoming_post').slideDown("slow").effect("highlight", {}, 3000);
$('.incoming_post').toggleClass("incoming_post").addClass("old_post");
}, "html");
}
该功能将检查留言板上是否有新帖子,如果有,则将其加载。由于某些原因,新数据永远不会加载到IE 7中,而会在FF和Chrome中很好地加载。而且,当我刷新页面时,数据也不进入-仅当清除缓存时。
对这个问题有帮助吗?
Internet Explorer缓存请求。参见cache
flag for jQuery Ajax requests。它将向URL添加一个随机查询字符串参数(基于当前时间),以使其唯一且不可缓存。如果您愿意,也可以自己执行此操作:cache
使用'request.php?_=' + (+new Date())
方法将jQuery.ajaxSetup选项设置为false。或者,使用$ .ajax方法执行相同的操作。