Thursday, January 31, 2008

Magic of Ajax with Ruby On Rails

Rails Implements Ajax

Rails has a simple, consistent model for how it implements Ajax operations.

Rails has a simple, consistent model for how it implements Ajax operations.

Once the browser has rendered and displayed the initial web page, different user actions cause it to display a new web page (like any traditional web app) or trigger an Ajax operation:

  1. A trigger action occurs. This could be the user clicking on a button or link, the user making changes to the data on a form or in a field, or just a periodic trigger (based on a timer).
  2. Data associated with the trigger (a field or an entire form) is sent asynchronously to an action handler on the server via XMLHttpRequest.
  3. The server-side action handler takes some action (that's why it is an action handler) based on the data, and returns an HTML fragment as its response.
  4. The client-side JavaScript (created automatically by Rails) receives the HTML fragment and uses it to update a specified part of the current page's HTML, often the content of a tag.

An Ajax request to the server can also return any arbitrary data, but I'll talk only about HTML fragments. The real beauty is how easy Rails makes it to implement all of this in your web application.

The 7 Habits of Highly Effective Web 2.0 websites

Steven Covey, author of “The 7 Habits of Highly Effective People” identified principals which also apply to modern Web 2.0 websites.

Highlights and Site Examples include:
  1. • Your customer is the boss- how your website can listen better
  2. • Start and update your website with your goals in mind
  3. • Balance user experiences with site goals
  4. • Deliver Value back to your web visitors
  5. • Be honest-examine and evaluate what doesn’t work
  6. • Web 2.0- Create an ongoing dialog and community with your customers
  7. • Sharpen your website’s saw- renewal techniques that work

No comments: