šŸ”” Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

jquery.autosave.js is a little plugin that can help auto-save input values to an ajax endpoint on your site so that user-input is constantly sync’d with the backend database without full-page post backs.

Ajax Plugins

Documentation

jquery.autosave.js

$("input").autosave({url:"/save",success:function(){},error:function(){}); 

That will bind a "change" event handler to all input elements, and post their values to the "/save" url each time the input value has changed.

Options

You can pass any of these options to the .autosave() function:

Option Type Default Description
url string null Url use to post ajax data.
event string change Event that causes the plugin to send data to your url. See jQuery.bind for options.
data object null Object that holds all data that will be posted back to the url when the event is fired. You can set global default values to be sent here. All data-* attribute values end up here, minus "data-" (e.g. "data-id" becomes "id").
debug boolean false Will stop any requests from being performed and will console.log the data variable inside of the autosave library
type string html You can now specify the dataType you are expecting (xml, json, script, or html)
success function function(data,$jqueryElement){} Callback used when data was saved successfully. The data returned from the ajax request, plus the jQuery element are passed to this method.
error function function(error,$jqueryElement){} Callback used when data was not saved, or there was an error. The jQuery element is passed to this method.
before function function($jqueryElement){} Callback called just before a request is sent to the server. The jQuery element is passed to this method.

You May Also Like