I need to create a javascript (jquery) array with duplicated key name like next one
{
"apple": "type1",
"apple": "type2",
}
Here is my current code I stack with
var data = {};
jQuery.each(formData, function(i, field) {
data[field.name] = field.value;
});
In above example field.name
is "apple"
have different values like "type1"
or "type2"
.
With my current code when same field.name
in jQuery.each
I got removed/erased "apple":"type1"