Constructing the Ajax Application
The previous lessons have introduced all the techniques involved in the design and coding of a complete Ajax application. In this lesson, we're going to construct just such an application.
Our first application will be simple in function, merely returning and displaying the time as read from the server's internal clock; nevertheless it will involve all the basic steps required for any Ajax application:
An HTML document forming the basis for the application
JavaScript routines to create an instance of the XMLHTTPRequest object and construct and send asynchronous server calls
A server-side routine (in PHP) to configure and return the required information
A callback function to deal with the returned data and use it in the application
Let's get to it, starting with the HTML file that forms the foundation for our application.