0
我有使用jquery选项卡功能的MVC 2项目。以下版本正在用于jquery和选项卡。在IE浏览器中缓存jquery选项卡9
的jquery-1.4.4.min.js jquery.tools.min.js 1.2.5
我有每个标签上的表单控件。在IE 9,当我点击保存特定标签
- 按钮从该选项卡中的信息会发布到DB精细
- 保存,新的信息留在网页上后,没有什么奇怪的发生在这里
- 当我点击一些其他选项卡,然后返回到我更改信息的选项卡上。它不显示我的更改,而是显示页面上第一次加载选项卡时的信息。
- 当我刷新页面时,该选项卡显示正确的信息(并且不像#3中所述那样陈旧)。
所以缓存不知道如何保持标签点击之间的变化。我如何解决上述#3中所述的问题?
HTML
<script type="text/javascript">
$(document).ready(function() {
JSGlobalVars.TabsAjaxCall('');
});
</script>
<div class="inside">
<div class="indentmenu">
<ul class="tabs">
<li><a id="GeneralInfo" href="/ProfileEditor/GeneralInfo?fice=XXXXXX&random=68564868">General Info</a></li>
<li><a id="Academics" href="/ProfileEditor/Academics?fice=XXXXXX&random=68564868">Academics</a></li>
<li><a id="Admission" href="/ProfileEditor/Admission?fice=XXXXXX&random=68564868">Admission</a></li>
<li><a id="CampusLife" href="/ProfileEditor/CampusLife?fice=XXXXXX&random=68564868">Campus Life</a></li>
<li><a id="CostAid" href="/ProfileEditor/CostAndAid?fice=XXXXXX&random=68564868">Cost & Aid</a></li>
<li><a id="Athletics" href="/ProfileEditor/Athletics?fice=XXXXXX&random=68564868">Athletics</a></li>
<li><a id="AutomatedOnlineSearch" href="/ProfileEditor/AutomatedOnlineSearch?fice=XXXXXX&random=68564868">Automated Online Search</a></li>
</ul>
</div>
<div class="insideContent">
<div class="panes">
<div style="display: block">
</div>
</div>
</div>
</div>
<div class="reset"></div>
</div>
JSGlobalVars
/* tabs handling*/
//pass tab only on load when displaying a specific tab
TabsAjaxCall: function (tabToDisplay) {
//$("ul.tabs").tabs("div.panes > div", { effect: 'ajax' });
$("ul.tabs").tabs("div.panes > div", { effect: 'ajax', history: true,
onBeforeClick: function (event, tabIndex) {
var $tabProgress = $("#tabProgress");
var $currentTab = $("ul.tabs").children('li').eq(tabIndex).children("a");
jLoaderShow($currentTab);
var tabPanes = this.getPanes();
},
onClick: function (event, tabIndex) {
jLoaderHide();
//to display specific tab on load
if (tabToDisplay != "" && typeof tabToDisplay != "undefined") {
JSGlobalVars.TabOnLoadIndexPerPassedValue(tabToDisplay);
//remove tab, we only need it during load and not on subsequest loads
tabToDisplay = "";
}
var tabPanes = this.getPanes();
}
});
},
TabCurrentRefreshCall: function (currentTabIndex) {
if (currentTabIndex == "" || typeof currentTabIndex == "undefined" || currentTabIndex == "undefined" || currentTabIndex <= 0) {
JSGlobalVars.TabsAjaxCall();
} else {
var $currentTab = $("ul.tabs").children('li').eq(currentTabIndex).children("a");
var id = $currentTab.attr("id");
if (id != "")
JSGlobalVars.TabsAjaxCall(id);
else {
//go the tab index route
JSGlobalVars.TabsAjaxCall();
var tabsApi = $("ul.tabs").data("tabs");
tabsApi.click(currentTabIndex);
}
}
},
TabIndexForSelected: function() {
var tabsApi = $("ul.tabs").data("tabs");
var currentTabIndex = tabsApi.getIndex();
return currentTabIndex;
},
TabOnLoadIndexPerPassedValue: function (myTab) {
var tabIndex = "";
if (myTab != '' && typeof myTab != "undefined") {
var isTabIndex = false;
$("ul.tabs").children('li').children("a").each(function (index) {
if (myTab.toLowerCase() == $(this).attr("id").toLowerCase()) {
tabIndex = index;
isTabIndex = true;
return;
}
});
if (isTabIndex) {
var tabsApi = $("ul.tabs").data("tabs");
tabsApi.click(tabIndex);
}
}
},
TabOnloadIndexPerHash: function() {
var tabIndex = "";
var hash = JSGlobalVars.GetHash();
if (hash != '' && hash != 'undefined') {
var isTabIndex = false;
$("ul.tabs").children('li').children("a").each(function (index) {
if (hash.toLowerCase() == $(this).attr("id").toLowerCase()) {
tabIndex = index;
isTabIndex = true;
return;
}
});
if (isTabIndex) {
var tabsApi = $("ul.tabs").data("tabs");
tabsApi.click(tabIndex);
}
}
},
GetHash: function() {
var hash = document.location.hash;
if (hash != '') {
hash = document.location.hash.substr(1, document.location.hash.length);
}
return hash;
}
问题是每次你离开标签页然后回去,它会重新向标签页的href请求页面。 IE9然后缓存结果。我只是不会使用动态加载的标签内容。 –
如果是这种情况,那么它应该从数据库中提取信息并显示正确的信息。本部分由数据库驱动,功能分为多个选项卡。 –
如果IE取而代之将其从缓存中取出,则不行。 :) –