sending parameters to ruby method from javascript

HI THERE,
In my .rhtml file I have some links.I need to invoke a ruby
method(controller's method/Helper method) and send link text as a
parameter on clicking the link.
Is it Possible..!

Thanks In Advance

sure:

link_to("my_text", { :action => "your_action", :some_param => "my_text"
})

this would give you "my_text" as params[:some_param] in your action. You
can add any number of parameters that way with whatever content you
want.

Yes it is possible.

link_to_function(name, *args, &block)

Returns a link that will trigger a JavaScript function using the
onclick handler and return false after the fact.

The function argument can be omitted in favor of an update_page block,
which evaluates to a string when the template is rendered (instead of
making an Ajax request first).

(Refer http://api.rubyonrails.com/classes/ActionView/Helpers/JavaScriptHelper.html#M001061
)

Thanks
-Pavan

Thanks for the reply..

       I am sorry for asking the question in the worst way.My question
is
can I pass a javascript variable to a Ruby Method call.?

Thank You.

Pavankumar Kulkarni wrote: