Please help me add history to this AJAX

Please help me add history to this AJAX

Hello! I'm a moderate user of jquery and have used it quite frequently to make AJAX calls. However, I'm stumped by this one. I need to keep my current structure but add history / browser back support. I've looked at the history plugin among others. I just can't seem to make anything work.

I'm using a basic ajax call that loads all links throughout the entire website. I need to add history support to that somehow.

Any help is greatly appreciated!

Here's the code:

  1. $(document).ready(function(){
  2.   $('a').live('click', function(){
  3.     var url = $(this).attr('href');
  4.     if(url.match('^http')){
  5.       return true;
  6.     } else {
  7.    $('#header').fadeOut("fast");
  8. $('#content').fadeOut( "fast", function() {
  9.    $("#container").append("<div id=\"content\"><div id=\"loader\">Loading<br/><span id=\"loaderimage\"></span><br/><br/><div id=\"error\">Not loading?</div><a id=\"cancelrequest1\" href=\"#\">Back to Dashboard</a><br/><a id=\"cancelrequest2\" href=\"#\">Back to Login</a></div></div>");  
  10.       });