2.0.2 • Published 5 years ago
form-async v2.0.2
Form Async
Form Async is an easy-to-use library that provide acronymous sending on form changes. It's a great solution to preventing data loss when filling out a web form.
Features
- Lightweight (~1.5kb gziped)
- Saves any HTML form element
- Support content editable property
- Full customization
- Retry functionality if ajax request fail
- Send form elements as group of field
- Provide the way to validate changes before sending ajax request
- Heavily tested
Installation
$ npm install form-asyncWe recommend installing from npm and then using a module bundler such as RequireJS, Webpack or Browserify.
Alternatively, you can use jsdelivr CDN instead of npm.
<!-- 1. Add JS before the closing `</body>` -->
<script src="jquery.js"></script>
<script src="form-async.js"></script>
<!-- 2. Initialize -->
<form action="/ajax/account">
<input name="xs_username">
</form>
<script>
$("form").async();
</script>Documentation
Read the docs for more details on how to use Form Async.
Callbacks
before— pre-request function that can be use to validate data before it is sentsuccess— function invoked if the request succeedserror— function invoked if the request fails
Software
We use Browserstack for manual testing