A simple jQuery form submitting plugin.
dist/
├── submitter.js (7 KB)
└── submitter.min.js (3 KB)
Two quick start options are available:
- Download the latest release.
- Clone the repository:
git clone https://github.com/fengyuanchen/submitter.git
.
Include files:
<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/submitter.js"></script>
Initialize with $.fn.submitter
method.
$('form').submitter({
done: function (e, data) {
console.log(e.type); // 'done'
console.log(e.namespace); // 'submitter'
console.log(data); // Response data
}
});
// Set submitter options
$().submitter(options);
// Change the global default options
$.fn.submitter.setDefaults(options);
Note: jQuery.ajax's options are available too.
- Type:
String
- Default: The form's "action" property
A string containing the URL to which the request is sent.
- Type:
String
- Default: The form's "method" property
The HTTP method to use for the request (e.g. "POST", "GET", "PUT").
- Type:
Function
- Default:
null
A shortcut of the "start.submitter" event.
- Type:
Function
- Default:
null
A shortcut of the "start.submitter" event.
- Type:
Function
- Default:
null
A shortcut of the "start.submitter" event.
- Type:
Function
- Default:
null
A shortcut of the "start.submitter" event.
Destroy the submitter.
$().submitter('destroy');
This event fires when the form is starting to submit.
This event is fired when the submit request succeeds.
This event is fired when the submit request fails.
This event is fired when the submit request finishes (after done
and fail
events are fired).
If you have to use other plugin with the same namespace, just call the $.fn.submitter.noConflict
method to revert to it.
<script src="other-plugin.js"></script>
<script src="submitter.js"></script>
<script>
$.fn.submitter.noConflict();
// Code that uses other plugin's "$().submitter" can follow here.
</script>
- Chrome (latest 2)
- Firefox (latest 2)
- Internet Explorer 8+
- Opera (latest 2)
- Safari (latest 2)
As a jQuery plugin, you also need to see the jQuery Browser Support.
Released under the MIT license.