Last active
June 2, 2021 14:30
-
-
Save scsskid/7d669ec17b71730637bc70a766373fb2 to your computer and use it in GitHub Desktop.
[Parse HTML FormData] #forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseFormData(formData) { | |
const formEntries = new FormData(formData).entries(); | |
const data = {}; | |
for (var [formElementName, value] of formEntries) { | |
data[formElementName] = value; | |
} | |
return data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment