|
Historically, innovative new projects are typically online, but Web programmers still feel that the rich capabilities of desktop software are out of their reach. But Ajax is closing the gap. How does Ajax do its stuff? The name Ajax is short for Asynchronous JavaScript and XML, and it's made up of several components: - Browser-based presentation using HTML and Cascading Style Sheets (CSS)
- Data stored in XML format and fetched from the server
- Behind-the-scenes data fetches using XMLHttpRequest objects in the browser
- JavaScript to make everything happen
JavaScript is the scripting language that nearly all browsers support, which will let you fetch data behind the scenes, and XML is the popular language that lets you store data in an easy format. Here's an overview of how Ajax works: In the browser, you write code in JavaScript that can fetch data from the server as needed. When more data is needed from the server, the JavaScript uses a special item supported by browsers, the XMLHttpRequest object, to send a request to the server behind the scenes -- without causing a page refresh. The JavaScript in the browser doesn't have to stop everything to wait for that data to come back from the server. It can wait for the data in the background and spring into action when the data does appear (that's called asynchronous data retrieval). The data that comes back from the server can be XML or just plain text if you prefer. The JavaScript code in the browser can read that data and put it to work immediately.
That's how Ajax works -- it uses JavaScript in the browser and the XMLHttpRequest object to communicate with the server without page refreshes, and handles the XML (or other text) data sent back from the server.
|