var PeelGVScript = (function (window, undefined) { var _fieldMapper = ""; function reqListener() { } var sendFormData = function (fieldsMap) { var name = document.getElementsByName('cm-name')[0].value; var email = document.getElementsByName('email')[0].value; var signedup = document.getElementsByName('futher-information-partners')[0].value; var inputQuery = "name=" + name + "&email=" + email; if (signedup.checked == true) { inputQuery += "&signed=1"; } var dataPayload = "data=" + encodeURIComponent(inputQuery); var oReq = new XMLHttpRequest(); oReq.addEventListener("load", reqListener); oReq.open("GET", "https://peelazuregoldvisionwebservice.azurewebsites.net/api/PeelGV/SendToGV?website=mediacity&" + dataPayload); oReq.send(); } var bindFormEvent = function (fieldsMap) { var _formsCollection = document.getElementById("footer-news-signup"); _formsCollection.addEventListener("submit", function(e) { var name = document.getElementsByName('cm-name')[0].value; var email = document.getElementsByName('email')[0].value; var inputQuery = "name=" + name + "&email=" + email; var dataPayload = "data=" + encodeURIComponent(inputQuery); var oReq = new XMLHttpRequest(); oReq.addEventListener("load", reqListener); oReq.open("GET", "https://peelazuregoldvisionwebservice.azurewebsites.net/api/PeelGV/SendToGV?website=mediacity&" + dataPayload); oReq.send(); setTimeout(function () { form.submit(); }, 1000); }); } return { SendFormData: sendFormData, BindFormEvent: bindFormEvent, }; })(window);