Reputation: 781
var data = {
formData : {
vendor: 'test',
extension: 'test2'
}
}
I am trying to append a serialized array to fromData.
How would I go about doing this.
Would I push it?
data.formData({ inputs.serializeArray() });
Thanks!
Upvotes: 0
Views: 45
Reputation: 817208
.serializeArray
[docs] returns an array of objects of the form {name: '...', value: '...'}
.
So you would have to iterate over the array and add each object to your formData
object:
$.each(inputs.serializeArray(), function(i, obj) {
data.formData[obj.name] = obj.value;
});
Upvotes: 1