[jQuery] Ajax history/back button - with a twist

[jQuery] Ajax history/back button - with a twist


Hi folks,
I have the classic ajax history/back button problem - with a
twist. :-) I'm developing a simple order form using Rails and jQuery.
On the top of the page there's a cart and right below it a search form
for products. When the user start to type in the search box results
are presented on the fly using ajax. When the user clicks on the item
he/she wants it's added to the shopping cart with ajax.
Now to my problem(s). If the user, after leaving the page, hits the
back button he/she is presented with an empty cart - because I updated
it with ajax before. Of course a browser refresh reveals the cart -
because there's a new request to the web server which renders it.
Thats the first problem, the second one regards the product search. If
the user performed a search before leaving the page the search results
are gone - because they where displayed with the help of ajax.
From my Google searches I have found these plugins:
* History/Remote
* jquery.history.js
* jQuery Address
Maybe one of these solves the search problem? (if I add the search
query as a hash to the url). But it doesn't solve the empty cart
problem. My gut feeling tells me that these plugins are more for
history when you have ajax style navigation - thats not really my
case. Please correct me if I'm wrong. :-)
What would be your approach in this situation? Thanks in advance.
Cheers
Sven Dahlstrand