Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. forms.forEach(function (form) {
  2.                 form.addEventListener('click', submitFunction, false);
  3.                
  4. });
  5.  
  6.  var submitFunction = function (submitEvent) {
  7.             if (typeof Empello !== "undefined") {
  8.                 submitEvent.preventDefault();
  9.                 Empello.getToken(function (token) {
  10.                     var hiddenInput = document.createElement('input');
  11.                     hiddenInput.setAttribute("type", "hidden");
  12.                     hiddenInput.setAttribute("name", "empello_token");
  13.                     hiddenInput.setAttribute("value", token);
  14.                     submitEvent.srcElement.appendChild(hiddenInput);
  15.                 });
  16.                 document.getElementById(submitEvent.currentTarget.id).submit();
  17.             } else {
  18.                 console.log("Empello is not defined.");
  19.             }
  20.         };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement