Displaying 2 results from an estimated 2 matches for "array_or_string_for_javascript".
2009 Jan 19
1
pass ruby array to javascript function
Im wondering how to go about passing a ruby array to a javascript
function. I was able to do this the other way around and pass a
javascript array to an action using JSON and convert it back to a ruby
array:
Object.toJSON(<%= array_or_string_for_javascript(@array) %>
then in the action I was able to do:
ruby_array = JSON.parse(params[:array])
But this time I want to pass an array to a javascript function through
a function call within :update
render :update do |page|
page << "setTime(#{time})"
end
whe...
2006 Mar 25
0
in_place_collection_editor
...ctionEditor("
+ function << "''#{field_id}'', "
+ function << "''#{url_for(options[:url])}''"
+
+ js_options = {}
+ js_options[''collection''] = "[#{options[:collection].collect{|i| array_or_string_for_javascript(i)}.join('','')}]" if options[:collection]
+ js_options[''value''] = %(''#{options[:value]}'') if options[:value]
+ js_options[''cancelText''] = %(''#{options[:cancel_text]}'') if options[:cancel_text...