Closed Nexcapto closed 8 years ago
Is this the right way to implement checking for duplicate e-mails? e.preventDefault doesn't actually get triggered since the function is called after the event's submit is called. I'm not really sure where to go from here.
$("#form").on('submit', function (e) { var temp; console.log($("#formtest_email").val()); $.post('?ok=1', { action: 'formerly/submissions/alreadySubmitted', formid: $("input[name=formId]").val(), email: $("#formtest_email").val() }, function(data, status){ console.log("already?:" + data.alreadysubmitted + "\nStatus: " + data.ok); temp = data.alreadysubmitted; console.log(temp); if (temp == true) { e.preventDefault(); console.log("Got here"); } }); });
Is this the right way to implement checking for duplicate e-mails? e.preventDefault doesn't actually get triggered since the function is called after the event's submit is called. I'm not really sure where to go from here.