jquery-fjax 基于 jquery 的片段异步加载 项目简介
jquery-fjax 页面片段异步加载基于锚点技术,支持所有浏览器,不需要浏览支持 history.pushState如果支持客户浏览器都支持 history.pushState ,建议使用 pjax需要引入 jquery 库,开发版本选用的是v2.2.1,其它版本未验证QQ:16349023<script th:src="@{${prefixPath}+'/assets/plugins/jquery-fjax/jquery.fjax.js'}" src="/assets/plugins/jquery-fjax/jquery.fjax.js"></script>
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
$(function() {
var fjax_options = {
fragment:'#pagecontent',
prefix:'/manage/',
beginLoad:function () {
console.log("begin");
},
endLoad:function () {
console.log("end");
},
success:function () {
console.log("success");
},
error:function () {
console.log("error");
},
'default_url': 'main',//default hash
'content_url': function(hash,prefix) {
//***NOTE***
//this is for Ace demo only, you should change it to return a valid URL
//please refer to documentation for more info
var hashValue=hash;
var path = document.location.pathname;
//var requestUrl=path + "/" +hashValue.replace(/^page\//, '');
//var requestUrl=path + "/" +hashValue;
console.log(prefix);
var requestUrl=prefix+hashValue;
console.log(requestUrl);
return requestUrl;
}
}
$('.page-content-area').fjax(fjax_options);
});
/*]]>*/
</script>
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
$(function() {
var fjax_options = {
fragment:'#pagecontent',
prefix:'/manage/',
beginLoad:function () {
console.log("begin");
},
endLoad:function () {
console.log("end");
},
success:function () {
console.log("success");
},
error:function () {
console.log("error");
},
'default_url': 'main',//default hash
'content_url': function(hash,prefix) {
//***NOTE***
//this is for Ace demo only, you should change it to return a valid URL
//please refer to documentation for more info
var hashValue=hash;
var path = document.location.pathname;
//var requestUrl=path + "/" +hashValue.replace(/^page\//, '');
//var requestUrl=path + "/" +hashValue;
console.log(prefix);
var requestUrl=prefix+hashValue;
console.log(requestUrl);
return requestUrl;
}
}
$('.page-content-area').fjax(fjax_options);
});
/*]]>*/
</script>