RJS is very good for sending Javascript code back to the browser saying "Your AJAX is successful and by the way you can update the UI to signal to the user using the following Javascript I am going to send you." How about other webpage interactivities, dynamic HTML, is RJS suited for doing that as well, or is Prototype.js, or jQuery, or plain Javascript statically loaded with the webpage, still more suited for doing it? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-May-27 07:57 UTC
Re: RJS suitable for doing interactivities within a webpage?
On May 27, 6:48 am, Jian Lin <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> RJS is very good for sending Javascript code back to the browser saying > "Your AJAX is successful and by the way you can update the UI to signal > to the user using the following Javascript I am going to send you." > > How about other webpage interactivities, dynamic HTML, is RJS suited for > doing that as well, or is Prototype.js, or jQuery, or plain Javascript > statically loaded with the webpage, still more suited for doing it?Well stuff like link_to_function, button_to_function etc... do allow you to supply a block (which yields an RJS page object) rather than a javascript fragment and there''s also the update_page helper which can turn a block of rjs into actual javascript. I''ve always thought of RJS as a bit of a crutch though. It doesn''t get too much in your way for simple stuff like toggle this field or highlight that object but beyond that it has its limitations. It''s awkward to test for example and fiddly to setup reusable classes or functions. If you need any substantial amount of javascript I really thing you should bite the bullet and just get comfortable with javascript (using a library like jquery or prototype is almost certainly a smart move though) Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.