Autosave Form with jQuery

Recently, I have had some questions about how to autosave a Form with jQuery. Here is a tutorial to help you with that.

1st approach: need jQuery and ajaxForm plugin

$(document).ready(function() {
startsave();
});
function startsave(){
var timeout = setTimeout( "save()", 10000 );
}
function save(){
$('#formLoad').ajaxSubmit(function(responseText){
alert("The form has been saved" + responseText);
startsave();
});
}

2nd approach: need jQuery , ajaxForm plugin and Timers plugin


$(document).ready(function(){
$('#formLoad').everyTime(10000, function(i){
$(this).ajaxSubmit(function(responseText){
alert("The form has been saved " + responseText);
});
});
});

Leave a comment