Created
June 19, 2012 12:34
-
-
Save adamrobbie/2953884 to your computer and use it in GitHub Desktop.
A javascript that can add autosave to any 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
setInterval(function(){ | |
var form = $('#my-form-id'); | |
var method = form.attr('method').toLowerCase(); // "get" or "post" | |
var action = form.attr('action'); // url to submit to | |
$[method](action, form.serialize(), function(data){ | |
// Do something with the server response data | |
// Or at least let the user know it saved | |
}); | |
},10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment