Erwin Erwin - 1 year ago 63
jQuery Question

jQuery how to take all multiple form data in one array?

I want to have all data of my forms in one array

$('#teamMedewerker :selected').each(function(i){
var form = $("form#urenformulier" + i).serializeArray();
$.each($(form), function(i, field){
//console.log( + " : " + field.value);
array = field.value;

I want this result but dont know how to get this.

Array (employee1(test,test,test), employee2(test1,test2,test3))

each form is an employee, there are multiple forms.

Answer Source

If i understand correctly you should use map instead of each

var arrayOfEmployees = $('#teamMedewerker :selected').map(function(i){
    return [$("form#urenformulier" + i).serializeArray()];

Now if you want to iterate over this you can do

         console.log(, field.value);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download