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.

What's in your rjs file ?

Fred

Frederick Cheung wrote:

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

> What's in your rjs file ?

> Fred

<script type="text/javascript"> function my_function(test){alert(test);} </script> 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