Rails and Ajax for active pages !

Ajax stands for Asynchronous JavaScript and XML. Ajax is not just a technology; it is a suite of technologies. Ajax incorporates the following elements:

- XHTML for marking up web pages
- CSS for style
- The dynamic display and interaction using the DOM
- Handling and data exchange using XML
- Data recovery using XMLHttpRequest
- And JavaScript links it all together

Ajax allows you to recover data to a web page without having to refresh the contents of the entire page. In the Web-based architecture, the user clicks a link or submits a form. The form is submitted to the server, which then returns a response. The answer is then displayed to the user on a new page.

When you interact with an AJAX web page, it loads an Ajax engine in the background. The engine is written in JavaScript and responsibility is both to communicate with the web server and display the results to the user. When submitting data using an AJAX form, the server returns an HTML fragment that contains the answer and displays only the server data that are new or changed, as opposed to refreshing the entire page.

How Rails Implements Ajax

AJAX allows for dynamic pages with JavaScript and XML / JSON to send requests to the server without reloading the page in the browser. Rails provides several ways to simplify the use of AJAX. The contribution of RJS is to allow JavaScript code generation, from Ruby code.
Rails has a simple and consistent pattern in how it implements Ajax operations. Once the browser has rendered and displayed the initial web page, different user actions cause the display of a new web page (like any traditional web app) or trigger an Ajax operation.

More about Rails ands Ajax ? Contact our ror developers here !

Discover our last paper