Hai frnds, Can we add ajax functionality in a layout? I was wondering if someone has an answer for that. In my layout current time is displayed.But if the time needs to be updated we have to refresh the page.I want it using ajax. Thanks, Veena -- 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.
<%= observe_field :suggest, :url => { :action => :find_suggestion }, :frequency => 0.25, :update => :suggest, :with => ''q'' %> it will refresh the id "suggest" if you cann''t understand you can also find observe_field method 2010/4/9 Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> Hai frnds, > Can we add ajax functionality in a layout? > I was wondering if someone has an answer for that. In my layout current > time is displayed.But if the time needs to be updated we have to refresh > the page.I want it using ajax. > > Thanks, > Veena > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Hai Anthony, I didn''t get the ajax part working.Ths is my code.Can you plz help me.... layout (home.html.erb) ...................... <div id="time_div"><h4 align="right"><%= @time %></h4></div> <%= observe_field :time_div, :url => {:controller=>"home",:action => :show_time },:frequency => 0.25, :update => :time_div %> Controller .......... class HomeController < ApplicationController def show_time @time=Time.now render :partial => "time", :object => @time end views/home/_time.html.erb .......................... <h4 align="right"><%= @time %></h4> Thanks, Veena -- 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.
Veena, try periodically call remote instead of observer field. Thanks, Bala On Mon, Apr 12, 2010 at 9:59 AM, Veena Jose <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hai Anthony, > I didn''t get the ajax part working.Ths is my code.Can you plz help > me.... > > layout (home.html.erb) > ...................... > <div id="time_div"><h4 align="right"><%= @time %></h4></div> > <%= observe_field :time_div, :url => {:controller=>"home",:action => > :show_time },:frequency => 0.25, :update => :time_div %> > > Controller > .......... > class HomeController < ApplicationController > def show_time > @time=Time.now > render :partial => "time", :object => @time > end > > views/home/_time.html.erb > .......................... > <h4 align="right"><%= @time %></h4> > > Thanks, > Veena > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Thanks Bala...... periodically call remote worked for me Thank You very much, Veena -- 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.