Forum: Ruby on Rails RJS: pass javascript variables in ruby calls

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Aa A. (Guest)
on 2009-03-07 22:45
(Received via mailing list)

I have this link_to_function which takes an RJS block as follows:

page.insert_html :bottom, :documents,
   :partial => "upload_fields",
   :locals => { :doc =>, :index => 'UNIQUE_ID' }

It adds a partial to a div. I need index to be a unique id, but can't
generate one.
I have an actual javascript function next_index() that will return the
next index that works.
Is there any way I can get the return value from that function passed
as the index parameter on the insert_html call? If not, is there any
way I can get a unique id in there?

Thanks for any help!
This topic is locked and can not be replied to.