From 8a8aa677f22b01f47a05b60ee0d265d23277801e Mon Sep 17 00:00:00 2001 From: Gustavo Beathyate Date: Sat, 16 Jun 2012 17:31:53 -0500 Subject: update AJAX guide intro [ci skip] --- guides/source/ajax_on_rails.textile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'guides/source/ajax_on_rails.textile') diff --git a/guides/source/ajax_on_rails.textile b/guides/source/ajax_on_rails.textile index bfd007490a..301b6060da 100644 --- a/guides/source/ajax_on_rails.textile +++ b/guides/source/ajax_on_rails.textile @@ -10,11 +10,23 @@ endprologue. h3. Hello AJAX - a Quick Intro -You'll need the basics of DOM, HTTP requests and other topics discussed here to really understand Ajax on Rails. +AJAX is about updating parts of a web page, without reloading the page. An AJAX call happens as a +response to an event, like when the page finished loading or when a user clicks on an element. For +example, let say you click on a link, which would usually take you to a new page, but instead of +doing that, an asynchronous HTTP request is made and the response is evaluated with javascript. +That way the page is not reloaded, and new information can be dynamically included in the page. +The way that happens is by inserting, removing or changing parts of the DOM. The DOM, or +Document Object Model, is a convention to represent the HTML document as a set of nodes that contain +other nodes. For example a list of names is represented as a @ul@ element node containing several +@li@ element nodess. An AJAX call can be made to obtain a new list item to include, and append it +inside a @li@ node to the @ul@ node. h4. Asynchronous JavaScript + XML -Basic terminology, new style of creating web apps +AJAX means Asynchronous JavaScript + XML. Asynchronous means that the page is not reloaded, the +request made is separate from the regular page request. Javascript is used to evaluate the response +and the XML part is a bit misleading as XML is not required, you respond to the HTTP request with +JSON or regular HTML as well. h4. The DOM -- cgit v1.2.3