Problem with AJAX and UJS with jQuery in Rails 3
After wasting a day...:-(
I found that When you generate a new Rails 3 application, a file called rails.js is created in the public/javascripts folder along with all the other .js files you are used to see in a Rails 2 project.
rails.js contains all the unobtrusive handlers. By default, Rails assumes you are using Prototype.js .
For Jquery replace the file rails.js with https://github.com/rails/jquery-ujs
The below link helped me:http://www.simonecarletti.com/blog/2010/06/unobtrusive-javascript-in-rails-3/
The "current" best way to handle this is to add this puppy to your gemfile
https://github.com/indirect/jquery-rails
run
bundle install
then
rails generate jquery:install #--ui to enable jQuery UI --version to install specific version of JQuery (default is 1.4.2)
then you're all set - it overwrites the default rails.js when you run the generator.
I had similar issues.Then, i decided since the problem was with Ajax, i should start with something very simple.So, i started with This