2.0.0 • Published 8 years ago

submit-form v2.0.0

Weekly downloads
373
License
MIT
Repository
github
Last release
8 years ago

Submit-Form

Utility build a form and submit it automatically. This library will intelegently reuse the same form and perform minimal manipulations for optimum performance.

This module can be required in node (for isomorphic apps) but will error on use.

Installation

Npm

npm install submit-form

Example

var submit = require("submit-form");

// Submit a hidden form.
submit("/my-form", {
	method: "POST",
	body: { a: 1 }
});

// Submit a different form.
submit("/my-other-form", {
	method: "POST",
	body: document.getElementById("my-form")
});

// Basically the same as clicking a link.
submit("/my-page");

// Alternatively you can submit to the current page.
submit({
	method: "POST",
	body: document.getElementById("my-form")
});

API Options / Defaults.

{
	method: "GET",
	body: {}, // The body will be flattened and inputs created for each value.
	enctype: "application/x-www-form-urlencoded",
	target: "_self"
}

Contributions

  • Use gulp to run tests.

Please feel free to create a PR!

2.0.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.4.6

8 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.7

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago