Returning JS in AJAX

David Teare
2005-06-02T01:07:54Z

I have Ajax working fine to return html code and display it in a div.
Now, I would like to return some JavaScript generated in the controller,
and have this execute in the browser.  I tried assigning the script code
to a div, which successfully put the script into the div, but the code
is never executed.

What I would like is something like DWR (http://getahead.ltd.uk/dwr/)
that allows you to define a JS function that will be executed with the
returned ajaxed data.  Is this possible in Rails?  I can port over the
DWR code, but I don''t want to reinvent the wheel.

Thanks!
--Dave.