On my page there is a panel that shows a list of car dealers. The panel displays a list of dealers with information for each dealer as mentioned below.
- For each dealer I need to show : name, address, phone, hours. The data is in json.
- name, address, phone : they are simple text-labels.
- hours: There is a link "View hours" for each deaaler. On clicking it, a text-label slides down the link showing "loading-gif" if hours data not yet present, else shows the hours data. Clicking link again hides the hours data.
When the page is rendered, this is the behavior I need:
- On page render I show name, address, phone labels & the hours link. As of now I do NOT have the hours information in json.
- After the page renders, I want to make a request to the server (Ajax ?), get the updated json with hours information & re-render the "view hours" so that when clicked it now shows the hours. This is what I do not know how to do.
Why am I not sending a json with hours information initially itself? This is because collecting that is expensive & very rarely will the "View Hours" link be used. So collecting all that data upfront will make the page render slow. I want the event/act of page loading trigger a request to get hours data & re-render only the hours text-label that slides down on clicking the "View Hours" link.
I looked at AjaxSelfUpdatingTimerBehavior
but its trigger is a time duration, not the page load.