Skip to content

Instantly share code, notes, and snippets.

@ivanaugustobd
Last active September 30, 2018 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanaugustobd/42a8020400d639595f50704c278f8398 to your computer and use it in GitHub Desktop.
Save ivanaugustobd/42a8020400d639595f50704c278f8398 to your computer and use it in GitHub Desktop.
const submitForm = (form, callback = null) => {
// [..]
fetch(form.action, [..])
.then(response => {
// [..]
if (callback) {
callback(response) // executa a função personalizada que varia pra cada form, passando a response pra ela
}
})
// [..]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment