Home arrow AJAX & Prototype arrow Page 4 - The Ajax Approach to ACP: A Simple Example

The Back Button - AJAX

This is the third part of my four-part series, "Active Client Pages, An Ajax Approach." In this part I illustrate the Ajax approach with a simple example, complete with code. Be sure to read the first two parts; they will help you understand what I'm trying to accomplish here, though the first part of this article does include a quick summary.

  1. The Ajax Approach to ACP: A Simple Example
  2. The Simple Example Code
  3. The Script in the DIV in the BODY
  4. The Back Button
By: Chrysanthus Forcha
Rating: starstarstarstarstar / 4
October 21, 2008

print this article



With the Ajax approach to ACP, the Back button of the browser is not enabled, no matter how many pages you display. This is because no window is changed. If you click the browser Refresh (Reload) button, you would have the very first page.

If you need the Back and Forward buttons, then you should create you own. You can create them at the top-left corner inside your web page. You have to write code for them, so that when each one is clicked, the necessary page will be displayed (from the array). With the simple example we had, the pages are in string forms in the array in the master page. The functions for the buttons would be easy to write if the contents of the pages do not depend on one another.

Rendering Web pages as they arrive

With the Ajax approach to ACP, the first web page should be rendered as it arrives at the browser. If you design your web page according to normal CSS flow, it should be rendered by the browser as it arrives, everything being equal.

The main problem occurs with HTML tables. If you want a table to be rendered as it arrives, declare column properties (e.g. widths) at the start of the table definition. Avoid the particular use of "0*" to specify column width. If you do not specify the column widths, the table may not be rendered incrementally, as it arrives.

The secret lies in giving the table column widths values at the beginning of the table definition. The widths can be in pixels, percentage or proportionally e.g. width="3*".

Advantages of ACP

Before we end this part, let us recall the advantages of ACP.

Any information stored at the server and its analysis can be presented quickly to the user with ACP, independent of whether the Internet connection is fast or slow. Only the first page may take some time to download through a slow Internet connection.

Web pages are becoming voluminous because authors are putting a lot of script into them. This leads to lengthy download times. With ACP, downloads won't take so long.

If you understand your scripting language very well, you will pay less for hosting since the analysis will now be done by your script at the client and not by some program at the server.

ACP frees the server from work and so increases overall speed of the World Wide Web. If every client uses ACP, a client will not have to wait too long for the server to serve other clients before it is served, since the processing will be done at the client and not at the server. In other words, the server will spend less time serving a client. One of the aims of N-Tier systems is to free the server from work. ACP also serves that purpose.

We will stop here and continue in the next part of the series.

>>> More AJAX & Prototype Articles          >>> More By Chrysanthus Forcha

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Best AJAX Tutorials for Forms
- The Best AJAX Tutorials
- 8 Great Ajax Tutorials
- Using Ajax and jQuery
- Using Ajax and jQuery with HTML Forms
- Ajax.org Offers Cloud9 IDE for JavaScript
- Java Technologies Provider ICEsoft Releases ...
- Using Recaptcha in AJAX Prototype Framework ...
- Google's Closure Compiler Service API: Addit...
- Installing Google Web Toolkit: Introducing t...
- Google's Closure Compiler Service API: Displ...
- Google's Closure Compiler Service API: Deliv...
- Google's Closure Compiler Service API: the A...
- Google's Closure Compiler Service API: the S...
- Google's Closure Compiler Service API: Optim...

Developer Shed Affiliates


Dev Shed Tutorial Topics: