我有以下例子:当用户点击一条导航线时,它使用美国宇宙航空研究开发机构的某些内容加载,并使用jquery史更新了该舱位和标题:。 plugin to do some RUS5 history.
ajaxNav: function () {
$( #uiTabs li a, .ajax ).live( click , function (e) {
e.preventDefault();
$( <div id="uiLoader"></div> ).appendTo( body ).hide().fadeIn();
var url = $(this).attr( href );
var bodyid = $(this).data( body );
$.ajax({
url: url,
timeout: 5000,
success: function (responseHtml) {
isAjaxNav = true;
var content = $(responseHtml).find( #ajax-nav-html );
$( .uiContent > .uiPadding ).html(content.hide().fadeIn( slow ));
History.pushState(null, $(responseHtml).filter( title ).text(), url);
$( body ).attr( id , bodyid);
$( #uiLoader ).fadeOut(function () { $( #uiLoader ).remove() });
},
error: function (jqXHR, textStatus, errorThrown) {
if (textStatus == timeout ) {
uiModal.errorTimeoutModal(jqXHR, textStatus, errorThrown);
} else if (jqXHR.status == "500") {
uiModal.error500Modal(jqXHR, textStatus, errorThrown);
} else if (jqXHR.status == "404") {
uiModal.error404Modal(jqXHR, textStatus, errorThrown);
} else {
uiModal.errorUnknownModal(jqXHR, textStatus, errorThrown);
}
$( #uiLoader ).fadeOut(function () { $( #uiLoader ).remove() });
}
});
});
},
然而,当用户点击背面或 forth子时,它将改变ur和所有权(因为假肢支持这一罚款),但内容不会改变! 我将如何发现这一点,以便我能够阅读新的尿素,例如<条码>(地点)$(路名);条码>,然后再读一些麻ja?
例如:
//IF back button or forward button clicked or relevant function e.g backspace
$(<!-- ? -->).click(function() {
// Get the current url when the back or forward button was clicked
var url = $( location ).att( pathname );
$.ajax({
url: url,
timeout: 5000,
success: function (responseHtml) {
isAjaxNav = true;
var content = $(responseHtml).find( #ajax-nav-html );
$( .uiContent > .uiPadding ).html(content.hide().fadeIn( slow ));
History.pushState(null, $(responseHtml).filter( title ).text(), url);
$( body ).attr( id , bodyid);
$( #uiLoader ).fadeOut(function () { $( #uiLoader ).remove() });
},
error: function (jqXHR, textStatus, errorThrown) {
if (textStatus == timeout ) {
uiModal.errorTimeoutModal(jqXHR, textStatus, errorThrown);
} else if (jqXHR.status == "500") {
uiModal.error500Modal(jqXHR, textStatus, errorThrown);
} else if (jqXHR.status == "404") {
uiModal.error404Modal(jqXHR, textStatus, errorThrown);
} else {
uiModal.errorUnknownModal(jqXHR, textStatus, errorThrown);
}
$( #uiLoader ).fadeOut(function () { $( #uiLoader ).remove() });
}
});
});