Why is FormData empty?
19,670
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"));
Related videos on Youtube
Author by
shibly
Updated on August 24, 2022Comments
-
shibly over 1 year
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?-
Rory McCrossan over 8 yearsWhat makes you think it's empty? It works in a basic example: jsfiddle.net/y9yd6okn
-
Donnie D'Amato over 8 years
-
-
Rory McCrossan over 8 yearsNote that
FormData.get()
only works in Firefox and Opera. -
Rory McCrossan over 8 yearsAre you sure? I get
Uncaught TypeError: formData.get is not a function
when I run it in Chrome 47: jsfiddle.net/pLyhnkw5. Also MDN says that this has no support in Chrome. -
Parth Trivedi over 8 yearsYes correct FormData() works but get function not working.