ajax makes WebApplications seem much more responsive, and may seem like magic at first, but it is really quite simple in principle.
Using AJAX, only small parts of a page are updated in response to the users actions. This contrasts with the traditional approach which reloads a whole new page everytime any change is needed. The AJAX approach results in a more responsive experience for the user, but as it depends on more sophisticated technology, it cannot be used in all cases.
Normally (in a non-ajax WebApplication?) every action the user takes results in an HTTP? request being sent to the server, to which the server responds with an whole new page for the browser to render.
This process can be time consuming, and is often largely unnessesary, especially if only a small part of the whole page needs updating. Further, having to wait for the server to complete request-response cycle (see UnderstandingWebApplications) before being able to interact with the page is needlessly unpleasant for the user.
Various methods have been developed to deal with this issue:
ajax is simply the culmination of this trend, with some added polish. A typical ajax set-up uses XML? to transfer data (thus providing even more separation than HTML vs. CSS) and updates the DOM at a much finer granularity than is possible with frames. It allows the user to continue working (the first “a” is "asyncronous").
In rails, this is all handled by a JavaScript package known as the Prototype library. This is included with the standard Ruby on Rails distribution.
Note, however, that Prototype.js passes content around as plain text, not as XML; to use XML you need to to do so explicitly. (In other words, the code typically makes calls to responseText, not responseXML, and most Rails actions will reply to XmlHttpRequst calls with a content-type of text/html, not text/xml. As a practical matter, this works fine for most cases, but is something to watch for if you want to actually have the X in AJAX.O’Reilly has posted a tutorial for using Ajax with Rails, entitled Ajax on Rails .