Ajax – dynamic content with link history

Use this script to update content dynamicaly. Original source from

http://www.unfocus.com/projects/historykeeper/

<script type="text/javascript" src="Scripts/history.js"></script>
<script type="text/javascript">
function PromptMe() {
this.historyListener = function(historyHash) {
stateVar = historyHash;
document.title = Title";

if (historyHash!= "" ){

new Ajax.Updater('id','url',
{method:'get', parameters:{variable:historyHash},
onCreate: function(){$('preloader').setStyle({display: 'BLOCK'});},//preloader=an image being displayed
onSuccess: function(){$('preloader').setStyle({display: 'NONE'});}//or not
});   //end of ajax updater

};  //function(historyHash)
}//end of if historyHash
unFocus.History.addEventListener('historyChange', this.historyListener);
this.historyListener(unFocus.History.getCurrent());
}; //function PromptMe()
</script>
<body onLoad="demoApp = new PromptMe();">
</body>

Leave a comment