user656925
user656925

Reputation:

Reload Methods: Complete Ajax Solutions

My web application utilizes page reloads in places where the page structure changes.

For content changes initiated by the user it is all handled by Ajax.

However I'm planning on removing all the page reloads and replacing them with ajax calls that simply update the page using innerHTML for the body and head tags.

To do this I know have to manually call functions that are normally called by the onload event.

When I am done I will have a complete ajax application. My question is, is this standard practice now....I see a lot of applications where you do something and the whole page reloads, where even common elements are reloaded.

For example go to Apple.com and hit on the first button you see "Store"...you will see the whole page reload even the menu bar that does not change is reloaded wasting bandwidth..

Because I don't see other people using complete ajax solutions...I wonder if I am headed down a wrong path.

My question?

Is a complete ajax based web application best practice? (of course file uploads aren't supported, omitting this, is it best practice).

If so why do big sites not do it? I see few sites that actually employ ajax instead of page reloads.

Upvotes: 0

Views: 71

Answers (2)

Sacred Socks
Sacred Socks

Reputation: 402

There are a number of reasons not to go fully ajax. A few are:

  1. If the user refreshes the page they'd be sent back to the home page; if they pressed the back button, they'd go back to the previous site they visited.
  2. Search engines won't be able to index anything past the home page.
  3. Anyone without javascript enabled or on IE 6 (or it's equivalent) wouldn't be able to use the site.

Lastly, it can be hell to debug a problem -- I went full ajax on a project a while ago and ended up regretting it.

If none of the above are important to your project, and you're looking to do something different, then by all means -- the real question you need to ask is "does the added complexity justify the savings in bandwidth?".

Upvotes: 1

user800014
user800014

Reputation:

The concept of ajax is reload certain content of the page when you don't need to change all the content.

Your example of apple.com: it isn't a best practice to use ajax in navigation, because the history of browser don't handle this (use the back button of the browser and the navigation will not respond if you use ajax, keep that in mind).

If you have a box with testimonials and want them to change from time to time, so it's a good place to use ajax, avoiding the whole page to reload.

You can also have a static page with all testimonials to let search mecanisms to index that content.

Example of big sites? The search of google. When you type only the box of results is reloaded to view one preview.

So you have to choose when use and when not use ajax.

Upvotes: 1

Related Questions