https://github.com/zackify/action.js
a mini library for turning form requests into ajax
https://github.com/zackify/action.js
Last synced: 7 months ago
JSON representation
a mini library for turning form requests into ajax
- Host: GitHub
- URL: https://github.com/zackify/action.js
- Owner: zackify
- Created: 2014-12-30T18:55:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-30T19:19:50.000Z (about 11 years ago)
- Last Synced: 2025-08-01T14:38:43.833Z (7 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
action.js
=========
#### Install via Bower
```
bower install zackify-action
```
Action.js is for easily turning your regular, lame form posts (and soon gets) into ajax calls. It's so easy to use
inside of `window.onload` or `$(document).ready`:
```
action(form,callback)
```
The form variable is the actual form dom node. In the example index, I just do this to grab every form and pass it to action.js
```
var forms = document.querySelectorAll('form')
for(var i=0; i < forms.length; i++){
var form = forms[i]
action(form,callback)
}
```
The callback will be called on at certain points, for now it will look like this
```
var callback = function(msg,form){
console.log(msg,form)
}
```
It will get a message, the only one currently is `loaded` which is called after clicking submit and the form posts along with the form that was submitted in the case of using multiple forms on a page.
#### What's Next?
If you like the idea let me know and I will continue working on this. Try pulling and opening up index.html and taking a look at the console to see how simple it is!