0

I have a javascript variable, I would to send along with my params when a person clicks a link.

var js_variable = something;
...
<%= link_to_remote "Link Name", {:url => {url_params}, ajax_options}, {html_options} %>

how do I add js_variable to the url_params hash??

Using rails 2.3.8

1
  • doesn't matter.... could be a string, int, whatever. Commented Sep 30, 2011 at 15:18

1 Answer 1

0

possibly this older question will be useful to you Rails3 - How to send Javascript Variable to a controller's action with the link_to helper?

But it seems to me you should be using link_to_function and change the href at runtime

Sign up to request clarification or add additional context in comments.

3 Comments

I'm using rails 2, probs should have said that.
there is a ralis 2 example =D
yeah I should have made it more clear in the comment that there was rails2 code in it :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.