Hi all, I have searched google for any basic Ruby on Rails application with Ajax. Any basic example where after clicking the button a webpage the application connects to the database and execute the query using AJAX and prints the information on the same page. Actually I have to give a presentation of a simple application of ruby on rails with Ajax. Any information will be appreciated. Thanks Syed -- 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 -~----------~----~----~----~------~----~------~--~---
On Nov 28, 2007 3:17 PM, Syed Rizvi <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have searched google for any basic Ruby on Rails application with > Ajax. Any basic example where after clicking the button a webpage the > application connects to the database and execute the query using AJAX > and prints the information on the same page. Actually I have to give a > presentation of a simple application of ruby on rails with Ajax. > > Any information will be appreciated.To find Ajax info related to Rails, you might want to search for rjs: http://www.google.com/search?q=ruby+on+rails+rjs -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
Greg Donald wrote:> On Nov 28, 2007 3:17 PM, Syed Rizvi <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> I have searched google for any basic Ruby on Rails application with >> Ajax. Any basic example where after clicking the button a webpage the >> application connects to the database and execute the query using AJAX >> and prints the information on the same page. Actually I have to give a >> presentation of a simple application of ruby on rails with Ajax. >> >> Any information will be appreciated. > > To find Ajax info related to Rails, you might want to search for rjs: > > http://www.google.com/search?q=ruby+on+rails+rjs > > > > -- > Greg Donald > http://destiney.com/greg is an expert. i would read his stuff. here is the basics, but again, greg is da man. :: put in the views layouts folder file name, header area <%= javascript_include_tag :defaults %> :: put where you want the link to be. you can cut it down if you want <%= link_to_remote ''CLICK ON LINK NAME'', :update => ''div_area'', :url => { :controller => ''name'', :action => ''name''}, :before => "$(''indicator'').show()", :success => "$(''here'').visualeffect(''highlight'')", :failure => "alert(''There was a failure error.'')", :complete => "$(''indicator'').hide()" %> <span id="indicator" style="display: none;"> TEXT TO DISPLAY WHILE GETTING THE REMOTE LINK </span> <div id="div_area"></div> -- 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 -~----------~----~----~----~------~----~------~--~---
KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-29 14:17 UTC
Re: Ajax and Rails basic application
Trent, I think there''s knowing it and knowing how to explain it. If the latter is the prize, you win it! I''m just completing a one year, 2000 hour Rails project with zillions of controllers and views and have always thought someday?? I''d get on the Java bandwagon. Thanks.. What does the "here" mean in the :success statement? Would you expect the ''stuff'' inside the "div_area" to be a partial? I am grateful for any mentoring. Kathy On Nov 28, 5:10 pm, Trent Black <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Greg Donald wrote: > > On Nov 28, 2007 3:17 PM, Syed Rizvi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > >> I have searched google for any basic Ruby on Rails application with > >> Ajax. Any basic example where after clicking the button a webpage the > >> application connects to the database and execute the query using AJAX > >> and prints the information on the same page. Actually I have to give a > >> presentation of a simple application of ruby on rails with Ajax. > > >> Any information will be appreciated. > > > To find Ajax info related to Rails, you might want to search for rjs: > > >http://www.google.com/search?q=ruby+on+rails+rjs > > > -- > > Greg Donald > >http://destiney.com/ > > greg is an expert. i would read his stuff. > > here is the basics, but again, greg is da man. > > :: put in the views layouts folder file name, header area > <%= javascript_include_tag :defaults %> > > :: put where you want the link to be. you can cut it down if you want > <%= link_to_remote ''CLICK ON LINK NAME'', > :update => ''div_area'', > :url => { :controller => ''name'', :action => ''name''}, > :before => "$(''indicator'').show()", > :success => "$(''here'').visualeffect(''highlight'')", > :failure => "alert(''There was a failure error.'')", > :complete => "$(''indicator'').hide()" > %> > <span id="indicator" style="display: none;"> > TEXT TO DISPLAY WHILE GETTING THE REMOTE LINK > </span> > > <div id="div_area"></div> > > -- > Posted viahttp://www.ruby-forum.com/.- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Trent, > I think there''s knowing it and knowing how to explain it. If the > latter is the prize, you win it! > I''m just completing a one year, 2000 hour Rails project with zillions > of controllers and views and have always thought someday?? I''d get on > the Java bandwagon. Thanks.. > What does the "here" mean in the :success statement? Would you expect > the ''stuff'' inside the "div_area" to be a partial? > I am grateful for any mentoring. > Kathy > > On Nov 28, 5:10 pm, Trent Black <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>''here'' is a typo on my part. doh! it is really ''div_area'' what will go in the div_area is what is rendered by the :action. so if the action name has a matching file name in the views/app name folder, that is what is rendered. if the action name, in the controller, is: def time @t = Time.now.to_s end the views folder file named time.rhtml gets put in the div_area. for example, just this one line will work in time.rhtml: THE TIME IS: <%= @t %> time.rhtml sits in the view folder of the controller that you are calling in the link_to_remote call. -- 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 -~----------~----~----~----~------~----~------~--~---
Trent Black wrote:> KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: >> Trent, >> I think there''s knowing it and knowing how to explain it. If the >> latter is the prize, you win it! >> I''m just completing a one year, 2000 hour Rails project with zillions >> of controllers and views and have always thought someday?? I''d get on >> the Java bandwagon. Thanks.. >> What does the "here" mean in the :success statement? Would you expect >> the ''stuff'' inside the "div_area" to be a partial? >> I am grateful for any mentoring. >> Kathy >> >> On Nov 28, 5:10 pm, Trent Black <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > ''here'' is a typo on my part. doh! it is really ''div_area'' > > what will go in the div_area is what is rendered by the :action. > so if the action name has a matching file name in the views/app name > folder, that is what is rendered. > > if the action name, in the controller, is: > > def time > @t = Time.now.to_s > end > > the views folder file named time.rhtml gets put in the div_area. > for example, just this one line will work in time.rhtml: > > THE TIME IS: <%= @t %> > > time.rhtml sits in the view folder of the controller that you are > calling in the link_to_remote call.I really appreciate the input of everyone. Sadly I am too new with Rails and the only reason for me to take this path is to give a presentation about how to incorporate Ajax in Ruby On Rails project. I have three more days to present my presentation, so I think with what I have read about it in Ajax On Rails book and your responses, I think I might be able to pull it off. People say that I am Java programmer and most of it I have learned writing,running and fixing real code. I will look in more about some working examples as that will help me create my own presentation. Thank you very much, and I really appreciate all the responses and looking forward in using this knowledge in my project. Thank you Syed -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Syed Take a look at ActiveScaffold which has AJAX baked in... CCH http://cch4rails.blogspot.com On Nov 30, 11:25 am, Syed Rizvi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Trent Black wrote: > > KathysK...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > >> Trent, > >> I think there''s knowing it and knowing how to explain it. If the > >> latter is the prize, you win it! > >> I''m just completing a one year, 2000 hour Rails project with zillions > >> of controllers and views and have always thought someday?? I''d get on > >> the Java bandwagon. Thanks.. > >> What does the "here" mean in the :success statement? Would you expect > >> the ''stuff'' inside the "div_area" to be a partial? > >> I am grateful for any mentoring. > >> Kathy > > >> On Nov 28, 5:10 pm, Trent Black <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > > ''here'' is a typo on my part. doh! it is really ''div_area'' > > > what will go in the div_area is what is rendered by the :action. > > so if the action name has a matching file name in the views/app name > > folder, that is what is rendered. > > > if the action name, in the controller, is: > > > def time > > @t = Time.now.to_s > > end > > > the views folder file named time.rhtml gets put in the div_area. > > for example, just this one line will work in time.rhtml: > > > THE TIME IS: <%= @t %> > > > time.rhtml sits in the view folder of the controller that you are > > calling in the link_to_remote call. > > I really appreciate the input of everyone. Sadly I am too new with Rails > and the only reason for me to take this path is to give a presentation > about how to incorporate Ajax in Ruby On Rails project. I have three > more days to present my presentation, so I think with what I have read > about it in Ajax On Rails book and your responses, I think I might be > able to pull it off. > > People say that I am Java programmer and most of it I have learned > writing,running and fixing real code. I will look in more about some > working examples as that will help me create my own presentation. > > Thank you very much, and I really appreciate all the responses and > looking forward in using this knowledge in my project. > > Thank you > > Syed > -- > Posted viahttp://www.ruby-forum.com/.- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---