Here's what I'm doing in Coffeescript:
good_docs = []
$('#documents_yes a').each (index) ->
good_docs.push parseInt($(@).data('id'))
$('.hidden-docs').val(good_docs) #this is a hidden field
The problem is that the array is passed to my rails app as ["1, 2, 3"]
, but I need it to go in as [1, 2, 3]
.
How can I do this? I thought the parseInt
call would handle it.