Today I learned some jQuery.
<script>
$('#mc-embedded-subscribe-form').on('submit', function(e){
e.preventDefault();
email=document.mc-embedded-subscribe-form.EMAIL.value;
$.post( "email.php", {email});
$('#fadeout').fadeOut(500);
$('#fadein').delay(500).fadeIn(500);
});
</script>
This is a script I'm running upon the event of a user submitting a form. The problem I'm having is that as soon as the form is submitted I get redirected to email.php, whereas I want to stay on the initial webpage. If I remove the line
$.post( "email.php", {email});
The rest works as expected. email.php works fine, it simply saves the email. What can I do to stop the redirect?