taken from the Alpha Blog http://alphasoftware.blogspot.com/

(Check out the blog there tend to be new postings everyday or almost everyday)

Inside Alpha AJAX 2nd in a series covering AJAX. The first one is at http://alphasoftware.blogspot.com/20...evelopers.html

Last week, we published the first in our series of AJAX capabilities in Alpha Five Version 9 Platinum. Today, I'm going to share a little bit about what we've done.

As any professional developer knows, Web applications that employ AJAX techniques are now very popular. AJAX UIs are clearly the wave of the present and future. But programming AJAX applications typically adds complexity to the development process.

Alpha Five Platinum bucks the trend with an extensive JavaScript library that simplifies development of AJAX-powered Web applications.

To see sample pages that use AJAX, see the sample Web Application that ships with Alpha Five Platinum. Select the "Sample and Tutorial databases" button on the Welcome screen when the application starts up, then select the "Application Server Demo" database. You can also simply go to http://afas.alphasoftware.com/SamplePagesv9/

In a traditional Web application, when the user clicks a button or hyperlink on the page, the data on the page is sent to the server, and the server sends back a new page for the browser to display. This means the server is doing a lot of work on each round trip because it has to re-compute the html for the whole page, and then send that back to the browser. So there are two sources of delay: the time taken by the server to re-compute the whole page, and the network transport time for sending the whole page over the internet.

There are many patterns that an AJAX application can take, but the most common one used in Alpha Five is for the browser to send some data to the server, and then for the server to send back a response to the browser in the form of some JavaScript commands. When the browser receives the response, it executes the JavaScript that was sent back. Typically these JavaScript commands will update the display on some portion of the page that is being viewed.

NOTE: The server could just as easily respond with data in text, XML, or JSON format (rather than JavaScript commands), but in the examples we present, the server typically sends back JavaScript commands because we believe that this is the simplest way to write AJAX applications. We just want to be sure you understand that Alpha Five does not lock you into any particular pattern.

It is important to note that this process is typically (although not necessarily) asynchronous (that's were the "A" in "AJAX" comes from). This means that once the browser has sent off the request to the server, the user is not blocked from doing anything else while waiting for the server to respond. The browser will keep checking in the background to see if a response has been received, and when one is received, it will respond in some way. For example, if the server's response is in the form of some JavaScript commands, it will execute these commands.

The Alpha Five AJAX Forms Library greatly simplifies the JavaScript programming necessary to implement AJAX techniques. An important aspect of the Alpha Five AJAX Forms Library is that it is cross-platform. It has been tested in all of the major browsers, including Internet Explorer, Mozilla (including Firefox), Safari, and Opera.

Every AJAX application starts with the browser initiating an AJAX callback to the server. The two key functions in the Alpha Five AJAX Forms Library that are used to initiate an AJAX callback to the server are

a5_AJAX_Callback()
a5_AJAX_Form()

Next time, we will cover everything in the a5_AJAX_Callback() function, so stay tuned.