Utility to easily submit forms in the browser.
npm install submit-formThis module can be required in node (for isomorphic apps) but will error on use.
#### Npm
``console`
npm install submit-form
`javascript
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")
});
`
`javascript``
{
method: "GET",
body: {}, // The body will be flattened and inputs created for each value.
enctype: "application/x-www-form-urlencoded",
target: "_self"
}
* Use gulp to run tests.
Please feel free to create a PR!