-
-
Save jsakhil/75d211b49d2a224a020aa2dec338dafa 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