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
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
Frederick C. 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.
On 21 May 2008, at 09:34, Suneeta Km wrote:
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
Suneeta Km wrote:
Frederick C. 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
How can I call an action from the function test? Please help
Suneeta