I am trying to use Jquery / ajax in rails 3.0.7. I do not understand what is the current situation about Jquery and rails.
Everywhere there is tons of hacks and plugins and scripts to use JQuery. So :
As of Rails 3, the JavaScript library you use is up to you. There are "drivers" created for the Rails primitives for Prototype and for jQuery. To set up jQuery, simply include the jquery-rails gem in your bundle file:
gem "jquery-rails"
...then run bundle install
.
If you don't already have jQuery installed in the project, you can run this command to install it:
rails generate jquery:install
In Rails 3.1, jQuery is the default, rather than Prototype. I personally believe it's because jQuery plays well with other JavaScript libraries, and that flexibility makes it more appealing to something like Rails. However, there are tons of arguments on all sides. I'm not sure if there's a definitive reason besides "jQuery is the new hotness."
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.