I know this may be a common question but I've been searching for a couple hours with no luck, so I figured I'd ask.
How do make a form submit through ajax on an input field change? I have a form where, among other things, a user selects a product from a dropdown, and then I want that product's picture to show immediately through ajax. This is what I have:
<%= f.association :product, collection: @products %>
<div id="prodPicture">...</div>
What I think might be the right way is adding remote: true and the url but I haven't gotten it to work as of yet.
<%= f.association :product, collection: @products, remote: true, url: url_for(controller: 'quotes', action: 'getdata'), type: 'JSON' %>
Is that the correct way to adding an ajax event to a form field change?
Thanks in advance for any help!