I’m learning to code in Ruby on Rails 5 with Ajax and a bit of jQuery. I had a hard time figuring out how to show the new item form on the index using Ajax, so that it doesn’t refresh the page or navigate to the new page view.
I got it working and thought I’d share how to do it.
In this video, you’ll see me modify link_to tag using remote: true, Ajax, and a bit of jQuery.
Upon clicking the link, it will instantly render the form partial on the index page, without refreshing or going to another page.
I hope this helped!