I want to do something similar to How to pass a Javascript variable to Rails Controller? but I can't seem to get it working for my purposes. I'm using drag and drop jQuery to transfer "items" to "pods". Here's my code:
function onReceive(id,pod_id){
var id = id;
var pod_id = pod_id;
confirm("Add " +id + " to " + pod_id + "?");
}
What I want to do is really something like this:
function onReceive(id,pod_id){
<% @pod_id = pod_id %>
<% @id = id %>
}
But I know that the solution isn't quite that easy. How can I pass id and pod_id to my controller? Ideally, I'd like to pass it to the update action. P.S.: I don't know AJAX at all, so if that's the only way please provide details...
onReceive(id,pod_id)method called at first? You can fetch and assign values from it.