data-url
attribute which
will be used to retrieve content:
.page-content
, you should have a .page-content-area
element which will be updated with new content.
New Title
html/ajax/ajax.html
file.
ace.enable_ajax_content
function and provide the following options:
content_url
: a function that returns a url to retrievedefault_url
: default url to loadloading_icon
: the icon to show when loading new content. Default is "fa-spinner fa-2x orange"loading_text
: the text to show when loading new content. Default is ""update_active
: whether to update "active" state of newly selected link and its parents. Default is trueupdate_breadcrumbs
: whether to update breadcrumbs. Default is trueupdate_title
: whether to update window title. Default is trueclose_active
: whether to close submenu of previously active items or not. Default is truetitle
tag and update_title
option is true (which is the default),
window title will be updated.
ace.enable_ajax_content(jQuery, { content_url: function(url) { //this is for Ace demo only, you should change it //url is the value from document url hash //take "url" param and return the relevant url to load return "content/"+url+".html"; }, default_url: 'homepage.html'//default url , loading_icon: "fa-cog fa-2x blue" });
New Title
ajaxloadstart
triggered when new content is requested.
ajaxloaddone
is triggered when ajax content is loadedajaxloadcomplete
is triggered when ajax content is loaded and inserted into domajaxloaderror
is triggered when loading ajax content has failedajaxscriptsloaded
is triggered when loading scripts is finishedjQuery(document) .on('ajaxloadstart', function(e, params) { //params.url and params.hash are available if(params.url == 'something') e.preventDefault(); if(params.hash == 'something') e.preventDefault(); //you can also return "false" from "content_url" function to prevent loading })