AJAX Autosave functionality

前端 未结 8 1646
旧巷少年郎
旧巷少年郎 2020-12-07 09:54

What\'s the best javascript library, or plugin or extension to a library, that has implemented autosaving functionality?

The specific need is to be able to \'save\'

8条回答
  •  遥遥无期
    2020-12-07 10:22

    If you're looking for simple and lightweight, I think the most lightweight you can get is using JavaScript's built-in setTimeout() function. Use it in combination with your choice of framework for the AJAX, and you're good to go.

    function autoSave()
    {
      $.get(URL, DATA); // Use any AJAX code here for the actual autosaving. This is lightweight jQuery.
      setTimeout("autoSave()", 60000); // Autosaves every minute.
    }
    autoSave(); // Initiate the auto-saving.
    

提交回复
热议问题