简体   繁体   中英

Ruby on rails add javascript variable to link_to url params

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM