mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 03:00:54 +00:00
use sender as the provider
This commit is contained in:
parent
b8666774e8
commit
1deb949c7d
@ -5,57 +5,19 @@ We send out newsletters about once a month.
|
||||
The newsletter includes information about new releases, upcoming events, community spotlights, and other news related to jsPsych.
|
||||
You can unsubscribe at any time.
|
||||
|
||||
<div style="text-align: left" class="sender-form-field" data-sender-form-id="m5li9yz5ejr0wrwxrw5"></div>
|
||||
|
||||
<form method="post" name="subscribeform" id="subscribeform" enctype="multipart/form-data">
|
||||
<input type="email" name="email" placeholder="Email address" id="email" size="40" class="md-input" required>
|
||||
<input type="hidden" name="htmlemail" value="1">
|
||||
<input type="hidden" name="list[2]" value="signup" />
|
||||
<input type="hidden" name="subscribe" value="subscribe"/>
|
||||
<button class='md-button md-button--primary' onclick="if (checkform()) {submitForm();} return false;" id="subscribe">Subscribe</button>
|
||||
<div id="result"></div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function checkform() {
|
||||
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
const emailInput = document.getElementById("email");
|
||||
const resultDiv = document.getElementById("result");
|
||||
|
||||
if (!re.test(emailInput.value)) {
|
||||
resultDiv.innerHTML = "Please enter a valid email address";
|
||||
emailInput.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function submitForm() {
|
||||
const emailInput = document.getElementById("email");
|
||||
const successMessage = 'Thank you for your registration. Please check your email to confirm.';
|
||||
const url = 'https://mail.jspsych.org/?p=asubscribe&id=6';
|
||||
const resultDiv = document.getElementById("result");
|
||||
const subscribeButton = document.querySelector('button#subscribe');
|
||||
|
||||
// Disable the subscribe button
|
||||
subscribeButton.disabled = true;
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded', // Adjust based on your content type
|
||||
},
|
||||
body: new URLSearchParams(new FormData(document.getElementById('subscribeform'))),
|
||||
});
|
||||
|
||||
const data = await response.text();
|
||||
resultDiv.innerHTML = successMessage;
|
||||
} catch (error) {
|
||||
resultDiv.innerHTML = 'An error occurred. Please try again later.';
|
||||
} finally {
|
||||
// Re-enable the subscribe button
|
||||
subscribeButton.disabled = false;
|
||||
}
|
||||
}
|
||||
<script>
|
||||
(function (s, e, n, d, er) {
|
||||
s['Sender'] = er;
|
||||
s[er] = s[er] || function () {
|
||||
(s[er].q = s[er].q || []).push(arguments)
|
||||
}, s[er].l = 1 * new Date();
|
||||
var a = e.createElement(n),
|
||||
m = e.getElementsByTagName(n)[0];
|
||||
a.async = 1;
|
||||
a.src = d;
|
||||
m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', 'https://cdn.sender.net/accounts_resources/universal.js', 'sender');
|
||||
sender('06a78af0a32181')
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user