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"));
Share:
19,670

Related videos on Youtube

shibly
Author by

shibly

Updated on August 24, 2022

Comments

  • shibly
    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
    Rory McCrossan over 8 years
    Note that FormData.get() only works in Firefox and Opera.
  • Rory McCrossan
    Rory McCrossan over 8 years
    Are 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
    Parth Trivedi over 8 years
    Yes correct FormData() works but get function not working.