I would like to create a button that, when clicked, pulls a subset of fields out a form on the same page and sends those fields' values as an array to the server as an XHR.
The server's response would then be used to update another element on the page.
So far I have got a button that pulls the subset of fields from the form and bundles their values into an array. But I don't know how to submit this via XHR to the server.
My code looks like this:
<%= button_to_function 'Calculate price', 'bundle_order();' %>
Can anyone help?
Thanks and regards,