Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- forms.forEach(function (form) {
- form.addEventListener('click', submitFunction, false);
- });
- var submitFunction = function (submitEvent) {
- if (typeof Empello !== "undefined") {
- submitEvent.preventDefault();
- Empello.getToken(function (token) {
- var hiddenInput = document.createElement('input');
- hiddenInput.setAttribute("type", "hidden");
- hiddenInput.setAttribute("name", "empello_token");
- hiddenInput.setAttribute("value", token);
- submitEvent.srcElement.appendChild(hiddenInput);
- });
- document.getElementById(submitEvent.currentTarget.id).submit();
- } else {
- console.log("Empello is not defined.");
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement