Skip to content

Instantly share code, notes, and snippets.

@mattbloomfield
Created August 23, 2024 17:25
Show Gist options
  • Save mattbloomfield/869d18038b59109f77de526a110c5c03 to your computer and use it in GitHub Desktop.
Save mattbloomfield/869d18038b59109f77de526a110c5c03 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html class="fonts-loaded" lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<!-- Load latest CSS from USChamber.com using manifest as guide -->
<script>
fetch('https://www.uschamber.com/dist/mix-manifest.json')
.then(response => response.json())
.then(data => {
const cssPath = data["/css/app.css"];
if (cssPath) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = `https://www.uschamber.com/dist${cssPath}`;
document.head.appendChild(link);
} else {
console.error('CSS path not found in mix-manifest.json');
}
})
.catch(error => console.error('Error fetching mix-manifest.json:', error));
</script>
<style>
[v-cloak] {
display: none !important;
}
</style>
<!--# if expr="$HTTP_COOKIE=/critical\-css\=/" -->
<!--# else -->
<script>
// Cookie.set("critical-css", "", { expires: "7D", secure: true });
</script>
<!--# endif -->
<link rel="icon" href="https://www.uschamber.com/dist/img/favicon.ico" sizes="any">
<link rel="icon" href="https://www.uschamber.com/dist/img/favicon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="https://www.uschamber.com/dist/img/apple-touch-icon.png">
<link rel="manifest" href="https://www.uschamber.com/dist/img/manifest.webmanifest">
<link rel="alternate" type="application/rss+xml" href="https://www.uschamber.com/rss/feed.rss">
<link rel="home" href="https://www.uschamber.com/"/>
<meta property="og:locale" content="en-US"/>
<title>Subscriptions | U.S. Chamber of Commerce</title>
<style>
.btn-primary{
background-color:;
}
#onetrust-consent-sdk {display: none;}
</style>
</head>
<body class="theme-default text-primary bg-primary overflow-x-hidden pt-header">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TKZD6BZ" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<!-- START: SFMC Content Builder Blocks -->
<div class="container">
<div data-type="slot" data-key="col1">
</div>
</div>
<!-- END: SFMC Content Builder Blocks -->
<script src="https://code.jquery.com/jquery-3.6.4.js" integrity="sha256-a9jBBRygX1Bh5lt8GZjXDzyOB+bWve9EiO7tROUtj/E=" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
/* Toggle subs on unsub */
$("#Unsub").change(function() {
if ($(this).prop("checked") == true) {
$(".subscriptions input").prop("checked", false);
$("#UnsubAll").show();
$("#UnsubAllDisabled").hide();
$("#UpdateDisabled").show();
$("#Update").hide();
} else {
$("#UnsubAll").hide();
$("#UnsubAllDisabled").show();
$("#UpdateDisabled").hide();
$("#Update").show();
}
});
$(".subscriptions input").change(function() {
if ($(this).prop("checked") == true) {
$("#Unsub").prop("checked", false);
$("#UnsubAll").hide();
$("#UnsubAllDisabled").show();
$("#UpdateDisabled").hide();
$("#Update").show();
}
});
/*Unsub All*/
$("#UnsubAll").click(function() {
var jobid = $("#JobID").val();
var email = $("#EmailAddress").val();
var subkey = $("#Subkey").val();
var subid = $("#SubID").val();
var listid = $("#ListID").val();
var processingurl = $("#ProcessingURL").val();
var confirmationurl = $("#ConfirmationURL").val();
var selected = [];
var selectednames = [];
$(".subscriptions input[type='checkbox']:checked").each(function() {
selected.push($(this).attr('value'));
});
var notselected = [];
$(".subscriptions input[type='checkbox']").not(":checked").each(function() {
notselected.push($(this).attr('value'));
});
/* var unsubURL = 'https://cloud.uschamber.com/https://cloud.uschamber.com/USChamberSubConfirm?' + 'email=' + email + '&subkey=' + subkey + '&subid=' + subid + '&jobid=' + jobid + "&listid=" + listid + '&selected=' + selected + '&notselected=' + notselected + '&unsub=true'; */
var unsubURL = '%%=CloudpagesURL("259", "email", @EmailAddress, "subkey", @Subkey, "subid", @SubID, "jobid", @JobID)=%%' + '&selected=' + selected + '&notselected=' + notselected + '&unsub=true';
console.log(unsubURL);
// var thisURL = encodeURI(unsubURL);
window.location.href = unsubURL;
});
/* Updates Records */
$("#Update").click(function() {
var jobid = $("#JobID").val();
var email = $("#EmailAddress").val();
var subkey = $("#Subkey").val();
var subid = $("#SubID").val();
var listid = $("#ListID").val();
var processingurl = $("#ProcessingURL").val();
var confirmationurl = $("#ConfirmationURL").val();
var selected = [];
var selectednames = [];
$(".subscriptions input[type='checkbox']:checked").each(function() {
selected.push($(this).attr('value'));
});
var notselected = [];
$(".subscriptions input[type='checkbox']").not(":checked").each(function() {
notselected.push($(this).attr('value'));
});
/* var thisUrl = 'https://cloud.uschamber.com/SubCenterProcessing?' + 'email=' + email + '&subkey=' + subkey + '&subid=' + subid + '&jobid=' + jobid + '&listid=' + listid + '&selected=' + selected + '&notselected=' + notselected + '&unsub=false'; */
var thisURL = '%%=CloudpagesURL("258", "email", @EmailAddress, "subkey", @Subkey, "subid", @SubID, "jobid", @JobID)=%%' + '&selected=' + selected + '&notselected=' + notselected + '&unsub=false';
console.log(thisURL);
// var thisURL = encodeURI(thisURL);
$.ajax({
method: "POST",
url: thisURL,
success: function(resp) {
$('success').show();
console.log("form is submitted");
/* var confirmURL = 'https://cloud.uschamber.com/USChamberSubConfirm?' + 'email=' + email + '&subkey=' + subkey + '&subid=' + subid + '&jobid=' + jobid + '&listid=' + listid + '&selected=' + selected + '&notselected=' + notselected + '&unsub=false'; */
var confirmURL = '%%=CloudpagesURL("259", "email", @EmailAddress, "subkey", @Subkey, "subid", @SubID, "jobid", @JobID)=%%' + '&selected=' + selected + '&notselected=' + notselected + '&unsub=false';
// var confirmURL = encodeURI(confirmURL);
window.location.href = confirmURL;
}
});
});
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment