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 application) or trigger an Ajax operation:
Some trigger fires :This trigger 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)
The web client calls the server: A JavaScript method, XMLHttpRequest, sends data associated with the trigger to an action handler on the server. The data might be the ID of a checkbox, the text in an entry field, or a whole form.
The server does processing: The server-side action handler ( Rails controller action )-- does something with the data and returns an HTML fragment to the web client.
The client receives the response: The client-side JavaScript, which Rails creates automatically, receives the HTML fragment and uses it to update a specified part of the current page's HTML, often the content of a tag.
These steps are the simplest way to use Ajax in a Rails application, but with a little extra work, you can have the server return any kind of data in response to an Ajax request, and you can create custom JavaScript in the browser to perform more involved interactions.
Rubyonrails web development
Ruby gem
Ruby gems
Ruby rails
__________________________
dreamajax
Subscribe now!
The Latest
Newsletter
Tech Tip Videos
- Nov-04-09
- Oct-29-09
- Oct-26-09
Recently Popular
From the Magazine
December 2009, #188
If last month's Infrastrucuture issue was too "big" for you then try on this month's Embedded issue. Find out how to use Player for programming mobile robots, build a humidity controller for your root cellar, find out how to reduce the boot time of your embedded system, and if you're new to embedded systems find out the basics that go into one. You can also read about the Beagle Board, the Mesh Potato and a spate of other interestingly named items. And along with our regular columns don't miss our new monthly column: Economy Size Geek.
Delicious
Digg
StumbleUpon
Reddit
Facebook








some Ruby on Rails examples
On March 7th, 2009 noman13bd says:
Hi, here are some examples of Ruby on Rails program. Hope all of u'll be benefited with it. Thnx.
__________________________Live validation in RoR
Auto completer in RoR
Ismail Muhammad Noman
share-facts.blogspot.com
ironic (maybe moronic)
On February 6th, 2009 chuck97224 says:
I find it ironic (maybe moronic) that the post talks about ruby on rails yet the links take you to a php server.
for example: the Rubyonrails web development link takes you here: http://www.railsonruby.com/RubyonRails-programmer.php
Post new comment