Building interactive web pages using AJAX and RJS
When we talk about interactive web applications, AJAX is one of the most important technologies. Rails provides an easy way to use Ajax in your web site through RJS. RJS helps you make and ajax request and have several page elements updated correspondingly. Implementing Ajax requests using RJS is a simple matter of doing the following: Include the requried javascript files. Use the right rails tags to launch an ajax request. Declare that your action in the controller can respond to rjs. Define the rjs response (the changes to the DOM). Any rails application has the javascript files (prototype.js, effects.js, dragdrop.js, controls.js, application.js) by default. All you need to do is to include them in your layout file by adding: Rails provide 'remote' alternatives for its link and form tags link_to_remote vs link_to form_remote_for vs form_for and form_remote_tag vs form_tag. Using the remote alternative will cause the html tags generated to have a new AjaxRequest call; so whe...