A JavaScript library for posting HTML form data
npm install @bigcommerce/form-poster
This is a JavaScript library for making a POST request as if you are submitting a HTML form. The request will have application/x-www-form-urlencoded content-type header. This is useful in situations where you want the same behaviour as submitting a HTML form without actually having the form in DOM.
You can install this package using npm or yarn. Below is an example of how to use it.
``js
import { createFormPoster } from 'form-poster';
const formPoster = createFormPoster();
const url = '/url/123';
const data = { field_1: 'foo', field_2: 'bar' };
formPoster.postForm(url, data, () => {
console.log('done');
});
`
To install dependencies:
`sh`
npm install
To transpile source code:
`sh`
npm run build
To bump and tag a release:
`sh``
npm run release