Why is there no data in FormData?
-
I expect FormData with the added data to be output to the console, but it's empty.
Can I get and output (name - value) in the console, or doesn't it work?
let formData = new FormData(); formData.append('name', 'value'); console.log(formData);
JavaScript Anonymous, Oct 15, 2019 -
console.log(Object.fromEntries(formData.entries()));
or
console.log([...formData.entries()].reduce((accumulator, [key, value]) => {
accumulator[key] = value;
return accumulator;
}, {}));Anonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!