Skip to content
Advertisement

FormData.append(“key”, “value”) is not working

Can you tell me whats wrong with this:

JavaScript

My output looks like this, I cant find my “key” – “value” pair

JavaScript

I can’t understand! Yesterday it worked so well, and today my head crashed the keyboard so many times! Firefox, Chrome, both the same :/

Advertisement

Answer

New in Chrome 50+ and Firefox 39+ (resp. 44+):

  • formdata.entries() (combine with Array.from() for debugability)
  • formdata.get(key)
  • and more very useful methods

Original answer:

What I usually do to ‘debug’ a FormData object, is just send it (anywhere!) and check the browser logs (eg. Chrome devtools’ Network tab).

You don’t need a/the same Ajax framework. You don’t need any details. Just send it:

JavaScript

Easy.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement