Loading through Ajax request and bookmarked URL

Posted by Varun on Stack Overflow See other posts from Stack Overflow or by Varun
Published on 2010-04-09T10:28:57Z Indexed on 2010/04/09 10:33 UTC
Read the original article Hit count: 553

Filed under:
|

I am working on a ticket system, having the following requirement:
The home page is divided into two sections:
Sec-1. Some filter options are shown here.(like closed-tickets, open-tickets, all-tickets, tickets-assigned-to-me etc.). You can select one or more of these filters.
sec-2. List of tickets satisfying above filters will be displayed here.

Now this is what I want: As I change the filters
--> the change should be reflected in the URL, so that one is able to bookmark it.
--> an ajax request will go and list of tickets satisfying the selected filters will be updated in sec-2.

I want the same code to be used to load the tickets in both ways-
(a) by selecting that set of filters and
(b) by using the bookmark to reload the page.

I have little idea on how to do it:
The URL will contain the selected filters.(appended after #)
changing filters on the page will modify the hash part of URL and call a function (say ajaxHandler()) to parse the URL to get the filters and then make an ajax request to get the list of tickets to be displayed in section2.
and
I will call the same function ajaxHandler() in window.onload.

Is this the way? Any suggestions?

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about page-load