views:

90

answers:

3

Hi. I have a web page which perform several ajax request and is modified, all ajax request are cached on the page. Then user clicks some link and performs the synchronous request to another page. Then user clicks "back" button of the browser. All data which was previously loaded via ajax is lost. Is it possible to restore the page state after user clicks "back" button in the browser, so all data previously loaded is restored without new ajax requests ?

The jQuery history plugin gives a little help, it allows to get back to the correct point of the page, but it performs necessary ajax requests. Additionaly if there are many ajax requests it is difficult to store them in the history correctly.

Is there a way to solve my problem without using cookies or server side ?

A: 

Really Simple History gives a very flexible API to manage the functionality of the back button.

Luca Matteis
I don't think that history allows to restore loaded ajax data.
braz
+1  A: 

Is there a way to solve my problem without using cookies or server side ?

The answer is likely 'no'. The data used for JS is driven by what is given from the server. In order to save the information, you will need to store it on the server and send it back.

The notion of strictly using JS will tie your hands unnecessarily. Saving this stuff to a session variable during the AJAX call to the server (since it's communicating with the server anyways) will likely be a fairly straightforward implementation.

Paulo
A: 

plz check this thread of Stack overflow, I have pasted code as well, this will help u... I have implement this, If you need furhter help, plz let me know
http://stackoverflow.com/questions/973739/how-can-i-get-the-same-page-with-the-click-of-back-button-of-browser/973753#973753

Muhammad Akhtar