Many web pages load all of their content to change very little information.
Now I would like to know why shouldn\'t the developers just use ajax for the main page re
Well, you can always add the onclick event unobtrusively using jquery and stop the normal URL handling.
Eg:
HTML
<a id="ajaxify-this" href="my-working-url">Click me to do AJAXy stuff if you have javascript</a>
then Javascript
$(document).ready(function() {
$("#ajaxify-this").click( function(e) {
updateContent(); // do something ajaxy with the page
return false; // stop the click from causing navigation
})
}
I'll give you one very good reason.
If you turn off javascript in the browser it won't work.
The whole premise really is that with AJAX you don't need to reload the whole page to update a small percentage of that webpage. This saves bandwidth and is usually much quicker than reloading the whole page.
But if you are using AJAX to load the whole page this is in fact counterproductive. You have to write customised routines to deal with the callback of the AJAX data. Its a whole lot of extra work for little to no increase in performance.
General rule for where to use AJAX: If your updating >50% of your page, just reload, else use AJAX.