【发布时间】:2010-12-01 13:15:43
【问题描述】:
有问题的页面是http://matthewanderson.cc
我是一个 javascript 新手,在基于 WordPress 的投资组合网站上工作。我正在使用 jQuery .load() 从 WordPress 帖子中获取内容,它适用于 Firefox、Safari 和 Chrome,但不适用于任何 IE。
具体的Ajax代码在这里:
$(document).ready(function(){
$("a.ajax-load").click(function (event) {
//prevent standard browser link behavior
event.preventDefault();
//Fade out any existing visible content
$("#project-expanded *:visible").fadeOut("slow");
//Insert loading graphic
$("#project-expanded").html('<p style="text-align:center;"><img src="http://matthewanderson.cc/wp-content/themes/tiles/ajax-loader.gif" width="16" height="16" style="margin:160px 0 0"/></p>');
//Pull URL from clicked object, store it in a variable, add string " #ajax-content" to be used in next line
var postAjaxURL = $(this).attr("href") + ' #ajax-content';
//Fetch content from the URL contained in postAjaxURL (filtering for #ajax-content), insert results into #project-expanded
$("#project-expanded").load( postAjaxURL, function(){
//Set CSS contents of #project-expanded to display:none so they can be faded in later
$("#project-expanded *").css("display","none");
//Expand #project-expanded using jQuery .show effect
$("#project-expanded").show("slow", function(){
//After #project-expanded is expanded, fade in the contents
$("#project-expanded *").fadeIn("slow");
});
});
});
我已将以下标头添加到所有要获取的页面以防止 IE 缓存,但这似乎没有帮助
<?
//Set no caching
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
有人有什么想法吗?
更新:
提一下,IE 的所有版本都没有报告任何 javascript 错误,这可能是谨慎的做法。
另外,我认为这不是缓存问题。在查看了使用 Fiddler 发出的页面请求后,我可以看到页面外部的内容被成功调用。
【问题讨论】:
标签: jquery ajax internet-explorer wordpress