views:

226

answers:

1

So basically, I have two tabs which contain regular and special e-mails. In order to get e-mails, you have to click on a calendar date and AJAX will then query the database for the regular e-mails and special e-mails. There is a next and previous button to navigate through the results gotten for the selected date. The problem I have is that since each tab keeps track of a separate set of e-mails, e-mail count, viewing e-mail n of n, and current e-mail.

My thought was that I could use setters and getters for each common variable. Basically, if I called getEmailCount() while in the first tab, I'll get the e-mail count for the regular e-mails by checking which tab is currently active. Only reason I ask is because I don't think have checking which tab is active in each function is the best way. I Googled it a bit, but really didn't know what I should have been searching for.

Edit: The AJAX requests only gets called whenever the user select a new date on the calendar. If there are results, the e-mails get stored in separate arrays. And if there are no results, nothing happens. As for the behavior of the tabs, it's quite simple. The tabs' sole responsibility is to display the e-mail info in HTML tables. The next and previous buttons are used to navigate through the e-mails.

Any thoughts?

Thank you.

+1  A: 
J5