Re: Render action inside js template

Fabio Kreusch
2009-08-31T10:40:58Z

Any thoughts?

On Aug 28, 9:30 am, Fabio Kreusch
<fabi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> Hello all,
>
> I''m trying to create the following:
>
> There is a index page that lists some items, and ''new
item'' button. I
> want the user to be able to click the button, and with ajax the page
> will be refreshed to show the new item form.
>
> For that, I added a format.js on my controller, and created a
> new.js.erb file for the action.
>
> My problem is, how can I, inside the new.js template, print the
> new.html action?
>
> Something like this:
>   $("#inner-content").html("<%=
escape_javascript(render(:action =>
> ''new'')) %>");
>
> It doesn''t work. Do I really have to create a partial for the
entire
> form to accomplish this?
>
> Thank you!