[jQuery] how to create a container for page flows and history

[jQuery] how to create a container for page flows and history


Hi -
I am new to jQuery. The question I have is probably a common one, and
hopefully it's got a common solution :)
I am wondering if there is an easy way to create a "container" to
contain a series of pages that would be loaded via ajax, possibly with
ability to handle history (i.e. goes back to the previous page loaded
within the container).
Right now it seems the main challenges are
1 - load pages via $('#field').load( callback );
2 - intercept the page's form or href and convert them to use ajax -
this appears to be doable within the callback.
3 - when ajax is triggered - the process repeats itself.
My trouble with step 3 is that I don't know how to write it in jQuery
so when the new page is loaded, step 2 is executed again - via
events?
4 - integrate with history, and maintain each #field separately; only
one particular #field is displayed at any time.
I found history_remote.js, and I'm not sure how it handles the
scenario above; it seems to create a new field and populate the data,
but doesn't appear to hide the newly created field when clicking on
back button; for now I am unclear on how to extend it.
Please let me know your approaches to address the above issues - the
reason I chose the above approach is because I already have a static
version of the site and would like to reuse the components as I can.
But if the above approach isn't the best way to handle the problem in
jQuery or ajax in general - please let me know too.
Thanks,
yc