Why is FormData empty?

shibly picture shibly · Dec 8, 2015 · Viewed 17.5k times · Source

I have followed this guide on MDN.

var formData = new FormData();    
formData.append("username", "Groucho");
formData.append("accountnum", 123456);
console.log(formData);

Why is formData empty?

Answer

Parth Trivedi picture Parth Trivedi · Dec 8, 2015

Their is way to access FormData

var formData = new FormData();

formData.append("username", "Groucho");
formData.append("accountnum", 123456);

console.log(formData.get("username"));
console.log(formData.get("accountnum"));