FormData created from an existing form seems empty when I log it [duplicate]
This question already has an answer here: How to inspect FormData? 14 answers I'm trying to get a set of keys (input names or similar) and values (input values) from a web form: <body> <form> <input type="text" name="banana" value="swag"> </form> <script> var form = document.querySelector('form'); var formData = new FormData(form); </script> </body> According to the FormData documentation , formData should contain the keys and values from the form. But console.log(formData) shows formData is empty. How can I quickly get the data from the form using FormData? JSFiddle Farray Update : the XHR