Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
naive AJAX auto-save implementation
<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