Using ajax to save and load without reloading the whole page
Much like the comments here, I'm trying to make comments on my app be submitted through ajax. I've added remote: true to my form, and made sure format.js is under the create method in the comments controller.
I've been testing the code below that I added to a new file at comments/create.js.erb
It's working and submitting comments, but I can't seem to get it to actually load the comment in the comments section. In other words, it submits correctly with the success message, but it doesn't actually show until I reload the page.
Thanks for any suggestions!
Posted about 5 years ago by