I've got the following jQuery variable:
var numbers = ["1", "2", "3"]
I want to submit a form with these numbers so that my params variable looks like this in the controller:
{
"evaluation" =>
{
"batch_subject_ids" => ["1", "2", "3"]
}
}
I am creating this array on the fly when I click a button
jQuery('<input>').attr({
type: 'hidden',
id: 'batch_subject_ids',
name: 'evaluation[batch_subject_ids][]',
value: batch_subject_ids
}).appendTo('form');
In the controller action, I receive the following params:
{
"evaluation" =>
{
"batch_subject_ids" => ["1,2,3"]
}
}
I can parse and replace the array, but I was wondering if I could send it from the client with the format I want without having to do that. How can I accomplish this? Thank you