Last active
April 14, 2022 09:48
-
-
Save sweetleon/85479e8cc239f5ec3552b0bcefe0492e to your computer and use it in GitHub Desktop.
naive AJAX auto-save implementation
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
<form method="POST" action="/our/url"> | |
<textarea name="input" onChange="save(event)" /> | |
</form> | |
<script language="javascript"> | |
function save(event) { | |
var request = new XMLHttpRequest(); | |
request.open(event.target.form.method, event.target.form.action); | |
request.send(new FormData(event.target.form)); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment