Created
February 7, 2020 05:57
-
-
Save FullZero5/85fb510deefbeb03ca8233d1f6ac31b6 to your computer and use it in GitHub Desktop.
js form
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
function send(e,form) { | |
fetch(form.action,{method:'post', body: new FormData(form)}); | |
console.log('We send post asynchronously (AJAX)'); | |
e.preventDefault(); | |
} | |
/*<form method="POST" action="myapi/send" onsubmit="send(event,this)"> | |
<input hidden name="crsfToken" value="a1e24s1"> | |
<input name="email" value="a@b.com"> | |
<input name="phone" value="123-456-789"> | |
<input type="submit"> | |
</form>*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment