Chapter 16. Creating Dynamic Interfaces with Rails and Ajax

Rails emerged at about the same time as Ajax did, and the two technologies can work tightly together. Ajax, a set of technologies for creating much more interactive interfaces in the browser, can connect neatly to Rails’ more server-based approach. There’s much more than that, though, as the Rails framework includes a number of components designed specifically for making it easier to build Ajax applications from inside of Rails.

Note

Rails 3.0 improves its Ajax handling pretty tremendously, shifting to an unobtrusive JavaScript approach that can support multiple JavaScript frameworks, including Prototype and jQuery. This chapter will still provide you with an overview of how easy it is to create Ajax applications in Rails, but the underlying details are changing.

Note

As we mentioned back in Chapter 5, you can download plug-ins, such as ActiveScaffold (http://activescaffold.com), that provide a lot of built-in Ajax functionality to get you started exploring.

Ajax Basics

If you need to read this section, it’s probably a sign that you should find a book devoted to Ajax before building Ajax applications on top of Rails. Rails provides an excellent set of technologies for supporting Ajax development, but you still need to know how to work with the JavaScript browser side of Ajax before you can make effective use of them.

Note

Ajax development is itself worth a book or even a shelf of books, depending on how you want to go ...

Get Learning Rails: Live Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.