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

Form Submitter is a simple jQuery form submitting plugin.

Forms Plugins

Documentation

Submitter

A simple jQuery form submitting plugin.

Main

dist/ β”œβ”€β”€ submitter.js      (7 KB) └── submitter.min.js  (4 KB) 

Getting started

Quick start

Three quick start options are available:

  • Download the latest release.
  • Clone the repository: git clone https://github.com/fengyuanchen/submitter.git.
  • Install with NPM: npm install @fengyuanchen/submitter.

Installation

Include files:

<script src="/path/to/jquery.js"></script><!-- jQuery is required --> <script src="/path/to/submitter.js"></script>

Usage

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   } });

Options

// Set submitter options $().submitter(options);  // Change the global default options $.fn.submitter.setDefaults(options);

Note: jQuery.ajax's options are available too.

url

  • Type: String
  • Default: The form's "action" property

A string containing the URL to which the request is sent.

method

  • Type: String
  • Default: The form's "method" property

The HTTP method to use for the request (e.g. "POST", "GET").

start(event)

  • Type: Function
  • Default: null

A shortcut of the "start.submitter" event.

done(event, data, textStatus)

  • Type: Function
  • Default: null

A shortcut of the "start.submitter" event.

fail(event, textStatus, errorThrown)

  • Type: Function
  • Default: null

A shortcut of the "start.submitter" event.

end(event, textStatus)

  • Type: Function
  • Default: null

A shortcut of the "start.submitter" event.

Methods

destroy()

Destroy the submitter.

$().submitter('destroy');

Events

start.submitter

This event fires when the form is starting to submit.

done.submitter

This event is fired when the submit request succeeds.

fail.submitter

This event is fired when the submit request fails.

end.submitter

This event is fired when the submit request finishes (after done and fail events are fired).

No conflict

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>

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Opera (latest)
  • Edge (latest)
  • Internet Explorer 8+

As a jQuery plugin, you also need to see the jQuery Browser Support.

Versioning

Maintained under the Semantic Versioning guidelines.

License

MIT Β© Fengyuan Chen


You May Also Like