views:

34

answers:

1

My html.erb template has this:

function f(arg) { 
<%= remote_function
:url => { :controller => "the_controller", :action => "the_action" },
:update => 'the_div',
:method => :post
%> ;} 

I'd like to do something like

:id => arg

or

:with => "'arg=...'"

... but I don't know what the value of arg is until after the page has rendered and the user does something. Any suggestions? Thanks in advance.

+1  A: 

this should work:

function x(arg) { <%= remote_function :with => '{id: arg}' %> }

keymone
Thanks for the nudge. This did the trick: :with => "'id='+ arg"
it's better to use hash-kind parameters to make sure all escaping and stuff is handled correctly
keymone