From 15a63052dc30e681a84f491264a8dbe8ec699158 Mon Sep 17 00:00:00 2001 From: Gustavo Beathyate Date: Sat, 16 Jun 2012 17:57:58 -0500 Subject: update DOM and HTML vs AJAX communication [ci skip] --- guides/source/ajax_on_rails.textile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'guides/source') diff --git a/guides/source/ajax_on_rails.textile b/guides/source/ajax_on_rails.textile index 224c318c99..1c502111d9 100644 --- a/guides/source/ajax_on_rails.textile +++ b/guides/source/ajax_on_rails.textile @@ -34,11 +34,21 @@ not required, you respond to the HTTP request with JSON or regular HTML as well. h4. The DOM -basics of the DOM, how is it built, properties, features, why is it central to AJAX +The DOM(Document Object Model) is a convention to represent HTML (or XML) +documents, as a set of nodes that act as objects and contain other nodes. You can +have a @div@ element that containsmother @div@ elements as well as @p@ elements +that contain text. h4. Standard HTML communication vs AJAX -How do 'standard' and AJAX requests differ, why does this matter for understanding AJAX on Rails (tie in for *_remote helpers, the next section) +In regular HTML comunications, when you click on a link, the browser makes an HTTP +@GET@ request, the server responds with a new HTML document that the browsers renders +and then replaces the previous one. The same thing happens when you click a button to +submit a form, except that you make and HTTP @POST@ request, but you also get a new +HTML document that the browser renders and replaces the current one. In AJAX +communications, the request is separate, and the response is evaluated in JavaScript +instead of rendered by the browser. That way you can have more control over the content +that gets returned, and the page is not reloaded. h3. Built-in Rails Helpers -- cgit v1.2.3