Created
January 20, 2017 10:53
-
-
Save sdumetz/65e16f06466bf22fd93e0ab2212ecc85 to your computer and use it in GitHub Desktop.
This file contains 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
//Rough implementation of application/JSOn formData submission https://darobin.github.io/formic/specs/json/ | |
function jsonFromForm(form){ | |
const formdata = new FormData(form); | |
//use iterable property of form.keys() to send JSON | |
const data = {}; | |
for(let key of formdata.keys()){ | |
data[key] = formdata.get(key); | |
} | |
return JSON.stringify(data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment