且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

自动保存表单输入使用原型和PHP

更新时间:2023-09-20 23:00:52

你可以只使用的Ajax.Request在使用setInterval,是这样的:

you could just use Ajax.Request with setinterval,something like this:

document.observe("dom:loaded", function() { 
    intervalID = window.setInterval("autosave()",500);
});

function autosave() {
    new Ajax.Request('autosave.php', 
    { 
    	method: 'post',
    	parameters: {id: $('id').value, save_text: $('myInput').value},
    });
}