Call Rails from Javascript

Is there any way to trigger a Rails action from Javascript?

The one way I can think of is use some sort of Rails listener on a
hidden form field, then update that field with Javascript. But that
seems like it’s going to put a huge load on my server, so it’s probably
not a great option. Anything more direct?

Thanks,
Chris

On 10/6/06, Chris [email protected] wrote:

This is kinda what ajax is used for.


Rick O.
http://weblog.techno-weenie.net
http://mephistoblog.com

Chris wrote:

Is there any way to trigger a Rails action from Javascript?

The one way I can think of is use some sort of Rails listener on a
hidden form field, then update that field with Javascript. But that
seems like it’s going to put a huge load on my server, so it’s probably
not a great option. Anything more direct?

Thanks,
Chris

<%= javascript_tag remote_function(
:url => {:action => ‘foo’}
) %>