What you're asking is basically "When should I use Ajax over data served on page load?"
Let's assume you're in a server-side language oriented stack (PHP, Ruby or any other language) since the notion of Ajax is somewhat different in a Node.js environment where everything is Ajax by nature.
1) Ask yourself:
Is this information central to the purpose of the page (action) ? Is it additional informations ?
If the page does not have any added value without a given information, then load it on page load. If it's some additional information or information whose loading can be deferred upon a given action (click), it can be fetched using Ajax.
2) Most of the choice is also dictated by the UX experience you' want to provide. Do you want to show this information on a separate page or is it small enough to be part of the current page?
3) Third parameter in the equation is performance. Sometimes you have to split your informations into smaller chunks for the page load time to be acceptable. Ajax is a great choice there to load some more informations without too much impact on the initial payload.
4) Then comes flexibility; Ajax is great for sidebar or header components such as notification indicator, message widget, etc. They are not mandatory for any page to fullfill its purpose and loading that kind of components using Ajax does not force you to modify every action of your app to load those components.
Adrien N.
What you're asking is basically "When should I use Ajax over data served on page load?"
Let's assume you're in a server-side language oriented stack (PHP, Ruby or any other language) since the notion of Ajax is somewhat different in a Node.js environment where everything is Ajax by nature.
1) Ask yourself:
If the page does not have any added value without a given information, then load it on page load. If it's some additional information or information whose loading can be deferred upon a given action (click), it can be fetched using Ajax.
2) Most of the choice is also dictated by the UX experience you' want to provide. Do you want to show this information on a separate page or is it small enough to be part of the current page?
3) Third parameter in the equation is performance. Sometimes you have to split your informations into smaller chunks for the page load time to be acceptable. Ajax is a great choice there to load some more informations without too much impact on the initial payload.
4) Then comes flexibility; Ajax is great for sidebar or header components such as notification indicator, message widget, etc. They are not mandatory for any page to fullfill its purpose and loading that kind of components using Ajax does not force you to modify every action of your app to load those components.