Skip to content

Commit 2ec17ed

Browse files
savvidesclaude
andcommitted
fix: submit email form via AJAX instead of redirect
Submits to Formspree via fetch so the user stays on the page. Shows green success or red error message below the form. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d135781 commit 2ec17ed

1 file changed

Lines changed: 34 additions & 3 deletions

File tree

docs/index.html

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,10 @@
556556
color: var(--text-muted);
557557
text-align: center;
558558
margin-top: 0.6rem;
559+
transition: color 0.3s;
559560
}
561+
.signup-note.success { color: var(--terminal-green); }
562+
.signup-note.error { color: #ef4444; }
560563

561564
/* Builder note */
562565
.builder-note {
@@ -633,12 +636,11 @@ <h1>
633636
<span class="gradient">Design better courses.</span>
634637
</h1>
635638
<p>Open source instructional design skills for Claude Code. Every recommendation is backed by peer-reviewed research, so you always know how strong the evidence is.</p>
636-
<form action="https://formspree.io/f/xkokkzyy" method="POST" class="signup-form">
639+
<form id="signup-form" class="signup-form">
637640
<input type="email" name="email" placeholder="your@email.com" required aria-label="Email address">
638641
<button type="submit">Get updates</button>
639-
<input type="hidden" name="_next" value="https://idstack.org/">
640642
</form>
641-
<p class="signup-note">No spam. Just releases.</p>
643+
<p class="signup-note" id="signup-note">No spam. Just releases.</p>
642644
</header>
643645

644646
<hr class="section-divider" style="margin-top: 3rem;">
@@ -1040,6 +1042,35 @@ <h3>Where we're headed</h3>
10401042
document.body.removeChild(textarea);
10411043
}
10421044
}
1045+
1046+
document.getElementById('signup-form').addEventListener('submit', function(e) {
1047+
e.preventDefault();
1048+
var form = this;
1049+
var btn = form.querySelector('button');
1050+
var note = document.getElementById('signup-note');
1051+
btn.disabled = true;
1052+
btn.textContent = 'Sending...';
1053+
fetch('https://formspree.io/f/xkokkzyy', {
1054+
method: 'POST',
1055+
body: new FormData(form),
1056+
headers: { 'Accept': 'application/json' }
1057+
}).then(function(res) {
1058+
if (res.ok) {
1059+
note.textContent = 'You\u2019re in! We\u2019ll keep you posted.';
1060+
note.className = 'signup-note success';
1061+
form.reset();
1062+
} else {
1063+
note.textContent = 'Something went wrong. Try again.';
1064+
note.className = 'signup-note error';
1065+
}
1066+
}).catch(function() {
1067+
note.textContent = 'Something went wrong. Try again.';
1068+
note.className = 'signup-note error';
1069+
}).finally(function() {
1070+
btn.disabled = false;
1071+
btn.textContent = 'Get updates';
1072+
});
1073+
});
10431074
</script>
10441075

10451076
</body>

0 commit comments

Comments
 (0)