views:

51

answers:

2

Getting some data from a MySQL database and loading it into the page. None of the stuff really needs to be retrieved at any point other than page load, so that advantage of Ajax is moot. Is there any other advantage to Ajax?

+1  A: 

It has the advantage that, if you can defer the retrieval of that data, you can potentially:

  • Make the page load faster (since the content sent will be smaller).
  • Provide more up-to-date content.

Additionally, if that data may not be retrieved, you can potentially:

  • Save bandwidth.
  • Lower the server load.

Finally, you need to use Ajax if you want to display content more recent than when the page was loaded without refreshing it.

EDIT

If you insist on loading everything when the page is loaded, the only possible reason I can concoct is when what you loading depends on some logic implemented in Javascript.

Artefacto
As noted in the question, all of the data will be retrieved on page load and should be available then.
Chris
@Chris I thought you were asking if there were any reasons to do otherwise.
Artefacto
A: 

Ajax's main role is to load a part of the website without reloading the whole page. Because of this ajax is to load new data after the page was loaded.

General Advantages [FASTER]:

  • Because you just reload a div for example its much much faster than realoading the whole page.

Advantages for you [NOTHING]:

  • If you load everything when the page loads and you don't want to load anything else after the page was loaded than you don't have any advantages.
CIRK