Name: ajaxable
Owner: PwC Experience Center
Description: Make your forms instantly ajaxable
Created: 2017-04-25 10:11:27.0
Updated: 2017-04-25 10:11:29.0
Pushed: 2017-04-25 10:18:37.0
Homepage: https://ajaxable.js.org
Size: 713
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This library simply takes the standard HTML forms as an input and make them send requests via AJAX keeping HTML5 validations.
Download the file from here, via npm i ajaxable
or get it directly from the /dist
folder
Basic
ipt src="path/to/ajaxable.min.js"></script>
m id="myform" method="POST" action="https://se.nd/it/somewhere">
nput name="name" placeholder="Name"/>
nput name="email" placeholder="Email" type="email" required/>
utton>Send</button>
rm>
ipt type="text/javascript">
axable('#myform');
ript>
Listen events
able('#myform')
tart(function(params) {
Make stuff before each request, eg. start 'loading animation'
nd(function(params) {
Make stuff after each request, eg. stop 'loading animation'
esponse(function(res, params) {
Make stuff after on response of each request
rror(function(err, params) {
Make stuff on errors
The params
argument is an object containing additional data about the specific request. For example, el
is the form element which made the request and activeRequests
indicates how many requests are still pending (useful with multiple forms)
Clone the repository and enter inside the folder
t clone https://github.com/artf/ajaxable.git
ajaxable
Install it
m i
Start the dev server
m start
Build before the commit. This will also increase the patch level version of the package
m run build
Run tests
m test
Run and watch tests
m run test:dev
All modern browsers (IE > 9)
MIT