I don't have access to run server-side code, so I can't do a PHP session for a registration form. I am going with a client cookie to ensure only one registration per person (per unique e-mail).
Following How do I set/unset cookie with jQuery? I thought I got the hang of it.
But it seems, even if I put in a new e-mail, it will always return alert("You've already registered");
. Why is that?
$("#submitBtn").click(function (event) {
var subject = "Registration for Walk-a-thon",
name = document.getElementById("name").value,
email = document.getElementById("email").value,
message = document.getElementById("message").value;
if (!$.cookie('client_email_cookie')) {
$.cookie("client_email_cookie", email, { path: '/', expires : 10});
log("Cookie: " + $.cookie("client_email_cookie"));
var link = "mailto:Jun.Ma2@otis.com; Allison.Rocca@utc.com"
+ "?cc=daniel.turcotte@carrier.utc.com"
+ "&subject=" + escape(subject)
+ "&body=" + escape(message)
;
window.location.href = link;
}
else {
alert("You've already registered");
}
});