formjs-sdk
v1.0.0
Published
SDK for form.castelnuovo.xyz
Downloads
2
Readme
FormJS-sdk
SDK for form.castelnuovo.xyz
Example
const FormJS = require("formjs-sdk");
const site_key = "sitekey";
// Send data from object
const data = {
name: "fooBar",
email: "[email protected]",
};
FormJS.send(site_key, data).then(
(response) => {
console.log("SUCCESS", response);
},
(error) => {
console.log("FAILED", error);
}
);
// Send data from html form
const form = document.querySelector(".form");
form.addEventListener('submit', event => {
event.preventDefault();
FormJS.sendForm(site_key, form).then(
(response) => {
console.log("SUCCESS", response);
},
(error) => {
console.log("FAILED", error);
}
);
})