I currently developing a site and have bumped into a problem.. (ajax loading stored urls) Thought someone could help..
First here is sample page layout:
<div id="main-container">
<div id="top-menu">
<a href="/link1" rel="ajax" />Link 1</a>
<a href="/link2" rel="ajax" />Link 2</a>
</div>
<div id="content">
<div id="results">
<!-- category results go here -->
<a href="/link1/category/cat-1/page/1" rel="ajax" />page 1</a>
<a href="/link1/category/cat-2/page/2" rel="ajax" />page 2</a>
</div>
<div id="categories">
<a href="/link1/category/cat-1" rel="ajax" />cat 1</a>
<a href="/link1/category/cat-2" rel="ajax" />cat 2</a>
</div>
</div>
</div>
All is well if i want to load content by clicking links.. The hard part starts when I want to enable history support (create deep linkable urls)..
I cant figure out how to load necessary parts if full url is given e.g.
site.com/link1.html#/category/cat-1/page/
Some ideas I have:
- Each link has an attribute that tells where to load the content
- The url is sent to some controller that sends back data about where to load
- The hash has multiple parts and can be split into array and then each part is loaded
Well the result should be somewhat like facebooks navigation where you can navigate between home page, messages, friends list without a page refresh.. And then in each of the places you can navigate by sublinks..