Created
December 1, 2018 00:14
-
-
Save chamatt/449bb2038a78f588166e53b819943ad7 to your computer and use it in GitHub Desktop.
Enviar formulário
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
| const formulario = document.querySelector("form"); | |
| formulario.addEventListener("submit", event => { | |
| event.preventDefault(); //Previne a atualização da pagina após enviar o formulário | |
| const dadosDoFormulario = { | |
| title: formulario.children.title.value, | |
| body: formulario.children.body.value, | |
| image: formulario.children.image.value | |
| }; // Pega os dados do formulário | |
| EnviarPost(dadosDoFormulario); // Chama a função que vai realizar a requisição | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment