Hi,
I am still new to RoR, so please bear with this newbie question. I
would like to have the application in view to press result back to the
controller when the periodically_call_remote is called. Right now,
this is the code in the view:
<div id="get_result"></div>
<%= periodically_call_remote(:update => ''get_result'',
:url => { :action =>
"getlog" },
:frequency => 2 );
%>
this is the code in the controller
def getlog
userid = params[:user_id]
if (userid == "1")
render :text => "Here"
else
render :text => "There"
end
end
I tried periodically_call_remote(:update => ''get_result'',
:url => {
:action => "getlog", :user_id = "1" }, :frequency => 2
), but it would
not work
--
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 Wai, Wai Tsang wrote:> I am still new to RoR, so please bear with > this newbie question.That''s what we''re here for! ;-) Seriously.> I would like to have the application in view to > press result back to the controller when the > periodically_call_remote is called.Are you sure? periodically_call_remote is typically used to fetch a value from the controller to pass back to the view. It sounds like you''re wanting (maybe in the next iteration of your code) to pass a user-entered value back to the controller. If that''s the case, then you''ll want to use observe_field. To answer the question you asked, though ... :url => { :action => "getlog", :user_id => ''1''} hth, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Walton wrote:> Are you sure? periodically_call_remote is typically used to fetch a > value > from the controller to pass back to the view. It sounds like you''re > wanting > (maybe in the next iteration of your code) to pass a user-entered value > back > to the controller. If that''s the case, then you''ll want to use > observe_field. > > To answer the question you asked, though ... > > :url => { :action => "getlog", :user_id => ''1''} > > hth, > BillThanks. I will look into observ_field. -- 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 -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- change parameters to periodically_call_remote
- Newbie question about periodically_call_remote
- Can I send a redirect_to() call to a periodically_call_remote() function?...
- Initial load time when periodically_call_remote
- Is there a huge performance difference between using multiple periodically_call_remote functions or one?