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.
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).
{
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