ONLamp.com_ Ajax on Rails
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
URL Tag Cloud
- ajax
- , ruby
- , rails
- , rubyonrails
- , programming
- , web
- , javascript
- , tutorial
- , development
- , ror
- , webdev
- , tools
- , coding
- , web2.0
- , reference
- , code
- , design
- , Website Development
Bookmark History
Saved by 94 people (28 private), first by anonymouse user on 2006-03-02
- Hksuper on 2008-07-02 - Tags rails , ruby , ajax , javascript , link_to_remote
- Wbahlke on 2008-05-21 - Tags rails , ajax , metrocascade
- Ken2016 on 2008-04-17 - Tags Diigo , - , Ken's , Bookmarks
- Ken2015 on 2008-04-16 - Tags Diigo , - , Ken's , Bookmarks
- Ken2013 on 2008-04-16 - Tags Diigo , - , Ken's , Bookmarks
Public Sticky notes
In the beginning, there was the World Wide Web. Compared with desktop applications, web applications were slow and clunky. People liked web applications anyway because they were conveniently available from anywhere, on any computer that had a browser. Then Microsoft created XMLHttpRequest in Internet Explorer 5, which let browser-side JavaScript communicate with the web server in the background without requiring the browser to display a new web page. That made it possible to develop more fluid and responsive web applications. Mozilla soon implemented XMLHttpRequest in its browsers, as did Apple (in the Safari browser) and Opera.
XMLHttpRequest must have been one of the Web's best kept secrets. Since its debut in 1998, few sites have used it at all, and most developers, if they even knew about it, never used it. Google started to change that when it released a series of high-profile web applications with sleek new UIs powered by XMLHttpRequest. The most visually impressive of these is Google Maps, which gives you the illusion of being able to drag around an infinitely sizable map in its little map window.
Highlighted by techieme
How Rails Implements Ajax
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:
- 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).
- Data associated with the trigger (a field or an entire form) is sent asynchronously to an action handler on the server via XMLHttpRequest.
- 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.
- 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
<div>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.
Highlighted by buzzart
Highlighted by mgibbons
Highlighted by nekochat
Highlighted by lacher


Public Comment
on 2006-08-03 by davekilleen
on 2006-08-18 by omalley