开发者

jquery.form vs remote_form

开发者 https://www.devze.com 2022-12-24 16:06 出处:网络
Could you tell me pros and cons of using jquery.form plugin and basic remote_form_for fro开发者_运维百科m RoR? What is better?If you\'re using rails 2.3 go with jQuery and form plugin. this method is

Could you tell me pros and cons of using jquery.form plugin and basic remote_form_for fro开发者_运维百科m RoR? What is better?


If you're using rails 2.3 go with jQuery and form plugin. this method is unobtrusive and does not pollute your HTML markup. while remote_form is always generating a bunch of inline Javascript.

jrails is good enough but not perfect. the whole idea of using jQuery is to have cleaner html markup by implementing behaviour through jQuery unobtrusively. jrails, on the other hand, having the goal of replicating rails javascript helpers, will introduce a lot of ugly inline js code into your markup.

Rails 3, endorsed unobtrusive Javascript design and stopped generating inline javascript. in rails 3 the javascript backend could be prototype, jQuery or any other js library you're using most often. you just need to replicate the rails.js file in your own library. I've already seen rails.js for jquery on github.


In Rails 2.3.x the remote_form is allways in prototype. If you wante change it, I suggest you to made your own Jquery script and after bind it to your form.

In Rails 3.x beta, the remote_form can be in Jquery or Prototype.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号