Re: Returning JS in AJAX

Thomas Fuchs
2005-06-02T06:02:41Z

Actually, I think both are.

Executing script that is returned by a view is as simple as using  a
:complete => ''eval(request.responseText'' insted of the
:update =>
''...'' in the
call to link_to_remote. That''s all there is to it.

There is also an example of this in my chapter of the beta rails book.

btw, the current version of the Upload Progress Patch updates Prototype
to have an optional feature to have blocks that
are
returned
with Ajax to be executed. This way, you can just return normal HTML
intermixed
with Javascripts.

See here: http://dev.rubyonrails.com/attachment/ticket/1026/
upload_progress_1356-3.diff
(search for "prototype.js").

---
Thomas


Am 02.06.2005 um 04:02 schrieb David Teare:

> Wow - that looks complicated!  I would have never thought of that.
>
> Erik''s approach looks much more straight forward.