If I have the following javascript code
var myVar = 0;
function setNewValforVar(newValue){
myVar = newValue;
}
and I call setNewValforVarthe ntimes function
so when I click the link, it sends the value myVarto the controller action in the remote link, for example
<%=link_to "My Link",{:action=>"myAction"},:data=>''sval='+myVar',:remote=>true%>
I Rails 2.3.x I would do it with
<%=link_to_remote "My Link",:url=>{:action=>"myAction"},:with=>"'sval='+myVar"%>
and I got it from the controller action using
params["myVar"]
How to do this on Rails 3 using the helper link_to?
source
share