Hi From an rjs file, I called a javascript function in ci.js as follows: page.call ''test'',params[:id]+''parents'' In ci.js I wrote the following: function test(div_name) { alert("testing........" +div_name) if ($(div_name)) { t=1; return t; } else { t=0; return t; } } Now in the rjs file I have to get the value of t which is returned from the function test in ci.js. How can I get the value of t? Please help. Thanks Suneeta -- 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 21 May 2008, at 08:26, Suneeta Km wrote:> > Hi > > From an rjs file, I called a javascript function in ci.js as follows: > page.call ''test'',params[:id]+''parents'' > > In ci.js I wrote the following: > function test(div_name) { > alert("testing........" +div_name) > if ($(div_name)) > { > t=1; > return t; > } > else > { > t=0; > return t; > } > } > > Now in the rjs file I have to get the value of t which is returned > from the function test in ci.js.You can''t. the rjs file is evaluated server side, but the javascript is executed on the client at a later state (except of course in the sense that your rjs can assign the result of that function call to another javascript variable, pass it as an argument to another javacsript function etc..., but there''s still the server/client boundary that can''t be crossed). Fred> > > How can I get the value of t? Please help. > > Thanks > Suneeta > -- > 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 21 May 2008, at 08:26, Suneeta Km wrote: > >> { >> Now in the rjs file I have to get the value of t which is returned >> from the function test in ci.js. > > You can''t. the rjs file is evaluated server side, but the javascript > is executed on the client at a later state (except of course in the > sense that your rjs can assign the result of that function call to > another javascript variable, pass it as an argument to another > javacsript function etc..., but there''s still the server/client > boundary that can''t be crossed). > > FredThank you Fred. Can you please give another solution to this problem? I have to replace a div if that div exists. So first I have to check the existence of 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 -~----------~----~----~----~------~----~------~--~---
On 21 May 2008, at 09:34, Suneeta Km wrote:> > Frederick Cheung wrote: >> On 21 May 2008, at 08:26, Suneeta Km wrote: >> >>> { >>> Now in the rjs file I have to get the value of t which is returned >>> from the function test in ci.js. >> >> You can''t. the rjs file is evaluated server side, but the javascript >> is executed on the client at a later state (except of course in the >> sense that your rjs can assign the result of that function call to >> another javascript variable, pass it as an argument to another >> javacsript function etc..., but there''s still the server/client >> boundary that can''t be crossed). >> >> Fred > > Thank you Fred. Can you please give another solution to this problem? > I have to replace a div if that div exists. So first I have to check > the > existence of div.Other than what I said when you asked yesterday, no. 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-/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 -~----------~----~----~----~------~----~------~--~---
Suneeta Km wrote:> Frederick Cheung wrote: >> On 21 May 2008, at 08:26, Suneeta Km wrote: >> >>> { >>> Now in the rjs file I have to get the value of t which is returned >>> from the function test in ci.js. >> >> You can''t. the rjs file is evaluated server side, but the javascript >> is executed on the client at a later state (except of course in the >> sense that your rjs can assign the result of that function call to >> another javascript variable, pass it as an argument to another >> javacsript function etc..., but there''s still the server/client >> boundary that can''t be crossed). >> >> FredHow can I call an action from the function test? Please help Suneeta -- 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 -~----------~----~----~----~------~----~------~--~---