say I have a form with several types of inputs with different name
attributes, and I want to pass these input values to a javascript function when the form is submitted.
Normally, when you submit a form the input values are passed to the server as name-value pairs via a GET or POST request. What I'd like to do is have the form pass those name-value pairs, as an object, to a javascript function.
Now, I realize you can just extract the input values by traversing the DOM and using the input id
tags, but I'd like to have my code independent of the specifics of the form. My function shouldn't need to go search for the specific input elements, it should just get the name-value pairs.
Can this be done?