Page.call

Hi Everyone,

I’m trying to get page.call to work and if i call something like
page.call ‘alert’, ‘this is a test’
everything works ok, however when i try calling a function that i
defined in application.js
function my_function(){
alert(‘this is a test’);
} i get NameError (undefined local variable or method `my_function’ for
#<ActionView::Base:.

Any idea what i’m doing wrong here. Any input is greatly appreciated.

Thank you,

On Oct 30, 6:03 pm, Wtn Tn [email protected] wrote:

Any idea what i’m doing wrong here. Any input is greatly appreciated.

What’s in your rjs file ?

Fred

On Oct 30, 8:06 pm, Wtn Tn [email protected] wrote:

function my_function(test){alert(test);}

page.call my_function

Well just as you wrote page.call ‘alert’ and not page.call alert you
need to write page.call ‘my_function’ (I’m assuming that script tag
isn’t actually in your rjs file as that clearly won’t work)

Fred

Frederick C. wrote:

On Oct 30, 6:03�pm, Wtn Tn [email protected] wrote:

Any idea what i’m doing wrong here. Any input is greatly appreciated.

What’s in your rjs file ?

Fred

page.call my_function