Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are returning in both true and false case on following condition </p> <pre><code>if(!validateEmail('email')) { $('.error').show(); return false; } else { $('.success').show(); return false; } </code></pre> <p>so function will not be execute after this, and check on <code>data: $("input#email").val()</code> earlier there was <code>email</code> variable, which was out of scope.</p> <p>so do like following</p> <pre><code>$(document).ready(function() { $('.error').hide(); $('.success').hide(); $('input#email').css({backgroundColor:"#FFFFFF"}); $('input#email').focus(function(){ $(this).css({backgroundColor:"#FFDDAA"}); $('.success').hide(); $('.error').hide(); }); $('input#email').blur(function(){ $(this).css({backgroundColor:"#FFFFFF"}); }); $(".submit_button").click(function() { function validateEmail(email) { var email = $("input#email").val(); var filter = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{0,4}$/; if(filter.test(email)) { return true; } else { return false; } } if(!validateEmail('email')) { $('.error').show(); return false; } $('.success').show(); $.ajax({ type: "POST", url: "process.php", data: $("input#email").val(), success: function() { $('#signup').html("&lt;div id='message'&gt;&lt;/div&gt;"); $('#message').html("&lt;h3&gt;You're signed up. Look for an invite from us soon.&lt;/h3&gt;") .css({color:"#FFFFFF", fontFamily: "Exo, sans-serif", fontSize: "18px", marginTop: "10px", marginRight: "200px", fontWeight:"500"}) .hide() .fadeIn(1500, function() { $('#message').append(""); }); } }); return false; }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload