Render action inside js template

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!

Any thoughts?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs