I have a page where I do this:
Which works fine. It checks if the user has already answered a question,
and picks either the creation form or the update form.
However, when I try to switch out this block of html using AJAX, it
won’t render the update form. When I look at the page source, I’m just
seeing the form that creates a new record, and it doesn’t work properly.
Anyone got any ideas how to do this properly?
My create.js.erb is:
$("#response").html(“
Answer created.
”);$("#submitForm").html("<%=
escape_javascript(render(‘questions/update_info_form’)) %>")
and update is just:
$("#response").html(“
Answer updated.
”);After I’ve clicked to create a new record, I get the ‘answer created’
and on the second click I get ‘answer updated’ like it should, but it
just updates it with no parameters