Is it possible to get form field data and serialize it by using the class assigned to two divs ?
I have 4 divs that contain form fields, only two DIVs are shown at a time. What is shown depends on a drop down selection.
select = 1
select = 2
You need to target the form controls within those elements. You can use the pseudo selector
:input to cover various control tags and types
data: $('.classOne :input').serializeArray()
Another common way to do this is to use
<fieldset> tags and disable the inactive ones. Disabling a fieldset disables any form controls within it so you can then effectively use
serialize() on the whole form since it does not include disabled controls