If you are completely new to AJAX (which stands for Asynchronous Javascript and XML), writing AJAX on Wikipedia is a good start point:
Like DHTML and LAMP, AJAX is not a technology in itself, but a group of technologies. AJAX uses a combination of:
- HTML and CSS for markup and style information.
- DOM access using JavaScript to dynamically display and interact with the information provided.
- A method for exchanging data asynchronously between the browser and server, thereby avoiding page reloads. An XMLHttpRequest (XHR) object is commonly used, but sometimes an IFrame or dynamically added tag is used instead.
- Data format sent to browser. Common formats including XML, pre-formatted HTML, plain text and JavaScript object notation (JSON). This data can be created dynamically in one form or another server-side scripts.
As you can see, from a purely technological point of view, there is nothing new. Most parts of AJAX were already there in 1994 (1999 for the XMLHttpRequest
object). The real novelty was to use these parts together, like Google with GMail (2004) and Google Maps (2005). In fact, both sites have contributed a lot to AJAX promotion.
The image, which is worth a thousand words, is below a diagram that illustrates the relationship between the client and the remote server, as well as the differences between classic and AJAX-enabled applications:
For the orange part, you can do everything manually (using the XMLHttpRequest
object), or you can use well-known JavaScript libraries such as jQuery , Prototype , YUI , etc. on the "AJAXify" client side of your application. Such libraries tend to hide the complexity of JavaScript development (for example, cross-browser compatibility), but may be redundant for a simple function.
On the server side, some frameworks (e.g. DWR or RAJAX if you use Java) can help, but all you have to do is basically open a service that returns only the information you need to partially refresh the page (first as XML / XHTML - X in AJAX - but JSON is often preferable these days).
Pascal Thivent 02 Oct. '09 at 15:12 2009-10-02 15:12
source share