ruby array to javascript - Rails -


i trying pass ruby array js view (js.erb format) doesn't work @ all.

var array = "<%= @publishers_list %>";

the variable array set string array's values in it.

is there way keep array format ?

edit

i realized because of array format.

[{:label => "name1", :value => value1}, {:label => "name2", :value => value2}]

i tried pass simple array like:

[1,2,3]

and worked fine.

the question now: how can pass kind of array ? need keep these hashes in because want put source of jquery autocomplete.

var array = <%= escape_javascript @publisher_list.to_json %> 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -