ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Ajax on Rails
Subject:   still confused
Date:   2005-09-19 11:33:10
From:   rhubarbo
I don't claim to know anything about rails, ruby or even AJAX, but I'm learning all three simultaneously and I'd really like to get this clear in my head.


The first page of this article describes AJAX in RoR Thus:


How Rails Implements Ajax


(simplifying)


1. trigger action - e.g. user making changes to the data on a form


2. Form Data sent asynchronously action handler on the server via XMLHttpRequest.


3. The server-side action handler ... returns an HTML fragment as its response.


4. The client-side JavaScript updates a specified part of the current page's HTML



Now I can see how this is much more responsive than a typical web app where the whole page is submitted then reloaded. In fact I see the Ajaxy elements as:


a) the form data is sent asynchronously and perhaps could be sent as the user types instead of after submit
b) a section of the page is updated instead of the whole page


But in general - it looks like you describe a normal web-app-like interaction - that is a full server round-trip to react to user input - just limited to a section of a page instead the whole page.
Is this what AJAX is really about?
Again - I know nothing about AJAX beyond the bits and pieces I've read - but I thought the whole point was that the UI reacts before the server round trip is made.
This is the distinction you describe in your example about a list being updated.


1 to 1 of 1
  1. Curt Hibbs photo still confused
    2005-09-19 11:51:13  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

1 to 1 of 1