I have a page which makes an ajax request and in the response is a link. If I click a link, then press "back", how do I avoid having the all of the ajax requests restart, and instead just take them back to how it was when they left? I'm having a mind blank.. I know this is a common issue...
I've found what I want to "copy", I just don't see exactly how they're doing it! http://www.apple.com/ca/search/?q=ipod (Interestingly, the Apple US search does NOT function this way and does in fact "do a new search" on back button) The search results are fetched via AJX. Click on a link, then hit your back button. The results and everything are all there immediately. No new request or anything. It also remembers any of the sections you have collapsed. Looking through their code as we speak, but is anyone able to provide some insight?
I'm not exactly an AJAX guru, but my guess would be to use PHP scripts (or whatever language you prefer) to set session variables. Write another script that checks for session variables and feeds the information to the JS function, which skips steps up until it runs out of data.
Whoa whoa whoa- no need to get uber fancey. Basically just use your ajax frameworks as usual, you know how to do that yea? Then when your ajax function is called to get a link then store the link name in an array. Your back button will call upon the function that loads a page using the last array slot. You can then remove it or create a forward button. But be sure if you make a forward button that it keeps track of how many times it has been pushed, so you can load the correct index number in the array. Simple in/decrementing is all that would be- on both the forward and back buttons. And if your not even worried about the mem use of your script, then save the data returned by the ajax function (the show results function) to store the data returned in an array. Yea alot of mem usage- but your can easily just that the data in a certain ajax slot into the div where you are showing your results. Hope this helps, and I can give you some code if it doesn't.