Skip to content

Instantly share code, notes, and snippets.

@LucasIron
Last active August 22, 2018 19:20
Show Gist options
  • Select an option

  • Save LucasIron/2f8a7891702b5a51624f0114637fdc15 to your computer and use it in GitHub Desktop.

Select an option

Save LucasIron/2f8a7891702b5a51624f0114637fdc15 to your computer and use it in GitHub Desktop.
fetch a form passing its input values as querystring parameters;
form => fetch(form.getAttribute('action') + [].reduce.call(form.querySelectorAll('[name]'), (params, input) => params + encodeURI(input.getAttribute('name') + '=' + input.value + '&'), '?')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment