Kindly read this information thoroughly before marking it as a duplicate. I currently possess an array of objects as shown below.
const filterParams = [
{ 'waterfront_type[]': 'Cove' },
{ 'area[]': 'Applehead Island' },
{ 'waterfront_type[]': 'Channel' },
{ 'waterfront_type[]': 'Open Water' },
{ baths: '0 - 14' },
{ price: '0.00 - 9,876,100.00' }
];
My objective is to iterate over this array and incorporate it into form data. I am attempting to achieve this with the following approach.
filterParams.map(param => {
return formData.append(param.key, param.value);
});
Expected Outcome: The parameter key is 'waterfront_type[]' and the value is 'Cove'. Therefore, internally it should be
formData.append('waterfront_type[]', 'Cove');
Current Outcome: Both key and value are returning as undefined.
formData.append(undefined, undefined);