简体   繁体   中英

How to implement Auto Save in ASP.NET MVC 4

While filling out a form, some websites like GMail offer an auto save feature that automatically saves the form filled out so far to the database.

If I have to implement that in my MVC 4 application, how do I do that?

I'm thinking of options but I can't find any other than write some JavaScript code myself to make an Ajax call and send data to the server in JSON format and on the server side, respond by having an action on the controller accept that JSON data, deserialize it and save the incomplete data to the database.

But all this seems like a lot of work. I am assuming there should be an easier way.

You could try the Sisyphus.js jQuery Autosave plugin . It works by saving the form state in LocalStorage, so that the user can retrieve the partially filled-out form. It has the virtue of not requiring any modifications to the server code, so it should work for any existing ASP.NET MVC application.

Download from Github here: https://github.com/simsalabim/sisyphus

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM