Hi, so I am attempting to gather a number of onclicks from the user with a javascript function and store them in an array. The problem is that I now want to be able to take that array and covnert it into ruby so that I can perform further functions on it and save it in the database. This is the function that I have so far: I am using JSON and trying to pass the array in an ajax.request call but it is not routing to the /appointments/array/ action. Is this the right way to go about it?
function test() { for(i=1;i<22;i++){ if (document.getElementById(i+'d').className == "selected"){ myArray.push(i); } }
new Ajax.Request('/appointments/array/', {method:'post',postBody:'data='+myArray.toJSON}); }