In my Tweets Controller, I have an array of tweets @tweets_array.
In my Tweets View/Show, I passed the value of @tweets_array to a data tag so that I can hopefully use the array in my javascript like so
<%= content_tag(:div, id: 'mycontainer', data: {source: @tweets_array})%>
In my javascript file, I want to set a variable var data to be @tweets_array so I can do some simply D3 visualization, so I call the following
var data = $('#mycontainer').data('source');
However, the above doesn't seem to work. I know that if i simply set var data = [1,2,3,4,5] then it works.
What is wrong with my way of retrieving the array from the view and passing it into the javascript?
This method is taken from this SO
content_tag?{:id=>"mycontainer", :data=>{:source=>[48.95, .......]}}, which seems right (I have numeric data in the array)