I'm encountering an issue while trying to send an array to a JavaScript function. Here's what I have so far:
Within the controller:
@data = [{date: '2014-08-17'}, {date: '2014-08-20'}].to_json
In the view:
<%= content_tag(:div, nil, :data => {:values => @data } ) %>
And in the JavaScript code:
var eventsList = $('#default').attr('data-values')
The problem is that the variable eventsList is being interpreted as a string rather than an array. How can I make sure that JS recognizes it as an array?