Possible Duplicate:
Ruby on Rails: Sending javascript data to ruby controller
Total noobie with JSON, javascript and RoR
In my RoR application I have some javascript on a webpage. I would like to pass in one of the arrays I have built up to a Ruby function in my controller (is that possible?)
I've read somewhere I need to convert to JSON. Using this command gives me something I can work with (totalChanges is my array)
JSON.stringify(totalChanges)
but how do I pass this to a ruby function? If anything doesn't make sense please straighten me out.
Thanks
EDIT:
I'm using jquery. The comments have pointed out that I can use something like http://api.jquery.com/jQuery.ajax/ to send data over to a controller.
the particular action I want to do is save some data (in a javascript array) to a database and then reload the page to show the new data. jquery.ajax just seems to have so many options I'm a bit lost.