[jQuery] history plugin
[jQuery] history plugin
Hello, I was wondering if anyone has successfully combined jQuery ajax
calls with a browser history plugin. I have seen lots of older posts,
and lots of older libraries, but not many examples for a current,
cross-browser solution. I have tried using Really Simple History
(http://code.google.com/p/reallysimplehistory/), and while it does add
the anchor pages to my history, the content remains the same when
going forward / backward. I also tried the JSSM plugin (http://
trac.nathanhammond.com/jssm/), I had to hack it up a little bit since
it tries to be all-in-one, but I had the same problems with it as with
RSH (history is there, but it doesnt do anything).
The history plugins listed in the jQuery plugins directory I have also
tried and the are either old, not up-to-date with current browsers, or
not fully functional.
Does anyone have a working example that they could point me to? Any
advice on how to integrate with one of the plugins I mentioned? Any
ideas as to why the history is there, but the page content does not
change?
Here are the ajax calls I would like to create a history for:
<code>
function ajaxMenu() {
$("#accordion .ui-accordion-data a").click(function(event) {
event.preventDefault();
$(".userTool").html("").append("<div id='loading' class='loading'
style='margin-top:7em;'><img alt='loading...' src='../images/ajax-
loader.gif'></div>");
var url = $(this).attr("href");
if(url.indexOf("?") == -1) {
url = url + '?';
} else {
url = url + '&';
}
url = url + 'ajax=true&skipNavigation=true';
$.ajax({
url: url,
complete: function(XMLHttpRequest, textStatus) {
$(".userTool").replaceWith(XMLHttpRequest.responseText);
$(".filtered",".userTool").columnFilters();
}
});
$("#accordion .ui-accordion-data a").removeClass("current");
$(this).addClass("current");
});
}
</code>