From 7e1d8283f2e698693b28682c5518fb564d1be72a Mon Sep 17 00:00:00 2001 From: bstankix Date: Mon, 24 Jul 2023 13:23:00 +0200 Subject: [PATCH] Update newsletter with filtered form fields (#18740) --- docs/_static/html/newsletter.html | 15 +++++++++++---- docs/_static/js/newsletter.js | 13 ++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/docs/_static/html/newsletter.html b/docs/_static/html/newsletter.html index 2bfdfde3d14..3283d54a43e 100644 --- a/docs/_static/html/newsletter.html +++ b/docs/_static/html/newsletter.html @@ -7,10 +7,17 @@

Be among the first to learn about everything new with the Intel® Distribution of OpenVINO™ toolkit.

- - + + + + + + + + +
- @@ -263,7 +270,7 @@
- +
diff --git a/docs/_static/js/newsletter.js b/docs/_static/js/newsletter.js index 54699e65b84..c9e7126e041 100644 --- a/docs/_static/js/newsletter.js +++ b/docs/_static/js/newsletter.js @@ -1,4 +1,5 @@ const eloquaUrl = 'https://s334284386.t.eloqua.com/e/f2' +newsletterFieldPrefix = 'newsletter-' // debug url // const eloquaUrl = 'https://httpbingo.org/post' @@ -41,7 +42,17 @@ $(document).ready(function () { const formHeight = $(this).outerHeight() $(this).removeClass('animated fade-up') $(this).animate({opacity: 0}, 200, 'linear', () => { - $.post(eloquaUrl, $(this).serialize()) + const currentUrl = window.location.protocol + '//' + window.location.hostname + window.location.pathname + $(this).append(``); + const rawFormData = $(this).serializeArray(); + const filteredFormData = []; + for (var entry of rawFormData) { + if (entry['name'].startsWith(newsletterFieldPrefix)) { + entry['name'] = entry['name'].replace(newsletterFieldPrefix, ''); + filteredFormData.push(entry) + } + } + $.post(eloquaUrl, $.param(filteredFormData)) .done(function(data) { // ---------- debug request data