我试图做一个动态的模板。我在侧边栏的链接,我要与.load()jQuery中动态地加载内容。
I'm trying to do a dynamic template. I have links in sidebar and I want to load the content dynamically with .load() in jQuery.
我有以下jQuery的code为:
I have the following jQuery code for that:
// Services AJAX page loader
jQuery('.sidenav a').click(function(){
$page_url = jQuery(this).attr('href');
// load page
jQuery('#content').fadeOut(200, function() {
jQuery(this).load($page_url, function(response, status, xhr) {
jQuery(this).fadeIn(200);
});
});
// set pagetitle
jQuery('.pagetitle span').text(jQuery(this).contents().first().text());
// change CSS current_page_item
jQuery('.sidenav li').removeClass('current_page_item');
jQuery(this).parent().addClass('current_page_item');
return false;
});
基本上,它除了在IE的伟大工程。
Basically it works great except in IEs.
在问题发生时,我点击这是首次没有AJAX加载的链接。你可以看到一个例子这里 。当你点击侧边栏的PROFIL /愿景,它将再次加载在#内容股利整个网站。它只会发生在IE的,在所有版本。 在其他浏览器中正常工作。
The problem happens when I click on the link that was firstly loaded without AJAX. You can see an example here. When you click on the "Profil/vision" in the sidebar, it will load the whole site in the #content div again. It happens only in IEs, in ALL versions. In other browsers it works normally.
任何想法可能是什么问题?
Any ideas what can be the problem?
感谢你。
推荐答案
我相信这是一个缓存的问题。
I believe it is a caching issue..
由于URL是一样的当前显示的页面,IE浏览器使用缓存(所有的页面的),并将其插入在#内容
DIV ..
Since the url is the same as the currently displayed page, IE uses the cache (with all the page) and inserts it in the #content
div ..
尝试添加时间戳的 .load()
要求
.load($ page_url,{非高速缓存:新的Date()的getTime()},函数(){..})
相关推荐
最新文章