You’re not receiving notifications from this thread.
I have an app for generating orders containg products. I'm currently using a “cart” through table that helps me connect both orders and products. I would like to have a list of products where users can select what they want from the list via checkbox for e.g. and then add them to an array that would be sent to my controller but I don’t want to reload page on each product add from the list. What would be the best way to add the X number of products to the params after user ’adds' them to the cart and press send?
I would recommend accumulating the products and their assocaited quantities as objects inside a local JS array. When the end-user presses "send", you can catch that event and build/send a FormData() object via Rails.ajax. See my example over at JSFiddle @ https://jsfiddle.net/pupdogg/okagmx6p/8/ as I'm not sure how to embed it here. I hope this helps!