I have an account setup wizard in Rails in which I’m showing a list of companies. When a company’s details are updated via AJAX, everything works perfectly. However, after a successful update I’d also like to replace the Update Client form with the New Client form.
It seems like the right thing to do would be to use AJAX to update the form’s containing element with the JS format response from companies#new. Is this possible from within the companies#new JS format response?
Yea, using ajax is a good thing to do in this case. As posted, a company’s details are successfully updated via ajax.
What you can do is render a json in update action if the current update is successful, and pass the new form as json.
You can access the json in your js and replace the current form element.
Let me know if this helps.