16bugs JavaScript: from Zero to Hero
Log in

JavaScript: from Zero to Hero

#301 lesson: getting all form data

Reported by Volkan Ozcelik · 29 Aug 2018, 18:32

Status
New
Priority
Normal
Assigned to
Volkan Ozcelik
Category
Lessons
Version
None

You can easily grab all HTML form data like this:

var data = new FormData(document.querySelector('form'));

This gives you key/value pairs that are ready for an AJAX call. Handy for those doing plain JS and HTML apps.

History

29 Aug 2018, 18:32Volkan Ozcelik submitted the bug