Skip to content

Instantly share code, notes, and snippets.

@hovancik
Created August 25, 2017 13:25
Show Gist options
  • Save hovancik/65b844c1cefa9f741b73dc2feeb7606a to your computer and use it in GitHub Desktop.
Save hovancik/65b844c1cefa9f741b73dc2feeb7606a to your computer and use it in GitHub Desktop.
      let form = document.getElementById('registrations')
      let body = new FormData(form)
      let headers = new Headers()
      headers.append('X-CSRF_Token', body.get('authenticity_token'))
      let action = form.action
      fetch(action, {
        headers: headers,
        method: 'POST',
        body: body
      })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment