View Single Post
  #2 (permalink)  
Old 10-30-09, 11:05 AM
BurkeFour BurkeFour is offline
Newbie Coder
 
Join Date: Oct 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
I'm guessing from what you describe, that you are not maintaining the state of the last-clicked item. In other words, the user requests the Home page of your app. Then they click on "Products", where you do a partial-page update to replace some of the HTML on the Home page with product information. As far as the browser is concerned, it's still on the home page. If you refresh that page, it will re-request it from the server, which re-initializes it to its default state (Home page). If you want to retain the state between refreshes, you have to utilize some state management. For example, you could use "hash navigation" where you navigate the page to a named anchor when changing to a different state. Then when you refresh, the page could special code to react differently based on the selected anchor (bookmark). Many JS frameworks have this out of the box. You can also look at doing cookies, etc. However, in general I would seriously consider changing your architecture here...this is sort of a convoluted way to build a website, unless you're just doing it this way to play with AJAX. If you do want to go this way, maybe try using an AJAX framework instead of manually coding against XMLHTTP...it would save you some hassle.
Reply With Quote