Skip to content

form-chimp/formchimp

Repository files navigation

Form Chimp API Lib

A tiny library for interacting with the Form Chimp API.
This is an optional companion to your Form Chimp tooling.
An alternitive would be using Axios HTTPS.

Form Chimp is a platform that makes working with web forms easiar by
handling the back-end and allowing you to define the front-end yourself.
So if you decide to impliment your form using Js...this lib is here to help with that.
Enjoy - Anas M.


How to...

1 - Add the lib to your project.

Using npm install the lib to your project with the below command.

npm i formchimp

Then, import it to your project like so...

import Chimp from 'formchimp'

If you want to use the bundled version, include a script tag on your HTML form that points to the bundled version.
<script src="https://cdn.jsdelivr.net/npm/formchimp/lib/build.js"></script>

2 - Submit to form

  1. Initialize the Chimp object with your form's id.
let myForm = new Chimp(form_ID)
  1. Once you want to submit to your form...just call the post method on the Chimp object.
myForm.post(data_Object)
.then((successMassage)=>{
    console.log(successMassage);
})
.catch((err)=>{
    console.log(err);
})

Once the post method is called, the lib will make an API call to your form using your form's ID that you've provided...Submitting the data to your form.


That's all for now...Thank you.
©2022 Form Chimp and it's creators. View Licence