Rails 3 passing a rails array to javascript function which uses a javascript array

前端 未结 5 857
悲哀的现实
悲哀的现实 2021-02-18 18:12

I am trying to pass a rails array to a javascript function. The function will then use the array values in javascript so I need to keep it an array.

Here is how I am

5条回答
  •  孤街浪徒
    2021-02-18 19:15

    Since this still seems like an issue and nobody resolved it. Here goes

    var js_array = [<%= raw @object.to_json %>];
    

提交回复
热议问题