Name
<form>
    Name
    <input name="name">
    <button id="submitButton" type="button">Submit</button>
</form>
<script src="//form2channel.com/js/form2channel.js"></script>
<script>
//Getting the submitButton
const submitButton = document.getElementById("submitButton");

//Adding the submitButton click event handler
submitButton.addEventListener("click", function(){

    //Validating the field
    if (document.getElementsByName("name")[0].value === "") {
        alert("Enter a name");
    } else {

        //The form submission call
        //You can pass any form into this function
        form2channel(document.forms[0])
        .then(data => {
            //The service returns a Json object that consists of:
            //A message: data.Message
            //A success boolean: data.Success
            console.log(data.Message);
        })
        .catch((error) => {
            //Catching the error
            console.log(error);
        });
    }
}, false);
</script>