I''m trying not to use RJS so my html (including images and text) is preloaded for quicker response. Example code: link_to_function(''ShowA'', replace_html(''myshow'', :inline=>''bunchofpreloadedhtmlA'')) link_to_function(''ShowB'', replace_html(''myshow'', :inline=>''bunchofpreloadedhtmlB'')) link_to_function(''ShowC'', replace_html(''myshow'', :inline=>''bunchofpreloadedhtmlC'')) <div id="myshow"> defaulthtml </div> This creates an error stating: undefined method `replace_html'' for #<#<Class:0xb6af826c>:0xb6af8244> If I try to use page. replace_html() I get the error: undefined local variable or method `page'' for #<#<Class:0xb6afc31c>:0xb6afc2f4> Another approach to achieve the same interaction might be to create each link to turn one div CSS display on while turning the other two divs CSS display values to none (in case they were on). Any ideas or other approaches appreciated. Thanks, DAN -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Um, if you are calling AJAX functions and Javascript response, you *must* use RJS. I''ll ignore the errors you are having and just answer your first issue: trying to get page hits faster, more caching of javascript. For that, please check out the Unobtrusive Javascript plugin here: http://www.ujs4rails.com/2006/8/21/announcing-ujs-rails-plugin-0-3 This puts the javascript for such calls as #link_to_function and #link_to_remote into a javascript file which can be cached by the browser. Give this plugin a try and let us know if you still have issues. Jason On 2/14/07, DAN <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I''m trying not to use RJS so my html (including images and text) is > preloaded for quicker response. > > Example code: > > link_to_function(''ShowA'', replace_html(''myshow'', > :inline=>''bunchofpreloadedhtmlA'')) > link_to_function(''ShowB'', replace_html(''myshow'', > :inline=>''bunchofpreloadedhtmlB'')) > link_to_function(''ShowC'', replace_html(''myshow'', > :inline=>''bunchofpreloadedhtmlC'')) > > <div id="myshow"> > defaulthtml > </div> > > This creates an error stating: > undefined method `replace_html'' for #<#<Class:0xb6af826c>:0xb6af8244> > > If I try to use page. replace_html() I get the error: > undefined local variable or method `page'' for > #<#<Class:0xb6afc31c>:0xb6afc2f4> > > Another approach to achieve the same interaction might be to create each > link to turn one div CSS display on while turning the other two divs CSS > display values to none (in case they were on). > > Any ideas or other approaches appreciated. > > Thanks, > DAN > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
DAN wrote:> I''m trying not to use RJS so my html (including images and text) is > preloaded for quicker response. > > Example code: > > link_to_function(''ShowA'', replace_html(''myshow'', > :inline=>''bunchofpreloadedhtmlA'')) > link_to_function(''ShowB'', replace_html(''myshow'', > :inline=>''bunchofpreloadedhtmlB'')) > link_to_function(''ShowC'', replace_html(''myshow'', > :inline=>''bunchofpreloadedhtmlC''))Try link_to_function("ShowA", render(:update) { |page| page.replace_html(''myshow'', ''somehtml'') }) -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---