Prototype is great, but you want to use Rails and AJAX in your application with jQuery and on your terms. Welcome Netizen!
We need to take a couple steps before we start using jQuery in-place of RJS, so let’s jump right in. Pretend you have a blog and you want to preview Comments using AJAX. That should set the scene:
Help Rails recognize AJAX requests
Remove layouts for AJAX requests automatically
Preview your Rails blog Comment
Here, the elegance of Rails and the beauty of jQuery combine at that miraculous middle ground of function and instinct. This is where you can embed your Rails Domain Model data into your jQuery code.
So to summarize, here are the steps to use jQuery in your next Ruby on Rails app:
That’s it! Don’t worry, you’ll get used to it soon enough. I’ve done it so many times that I can do it in my sleep. It’ll take you a tad bit longer, but stick with it. Good Luck!