title: validate captcha before submit
body: <p>I've use <code>captcha</code> for form registration, within that I have <a href="http://www.position-relative.net/creation/formValidator/" rel="nofollow"><strong>validation engine</strong></a> for form inline validation.   I'm stuck in validating the <em>equity of <code>captcha</code>.</em></p>
  
  <pre><code>&lt;p class="veriText"&gt;
      &lt;label&gt;Enter the Verification Text &lt;/label&gt; &lt;span style="color:red;"&gt;*&lt;/span&gt;
      &lt;input class="validate[required] text-input" type="text" name="captcha" id="captcha" class="text" value="" /&gt;                   
  &lt;/p&gt;
  &lt;img src="&lt;?= get_bloginfo('template_url'); ?&gt;/captcha_code_file.php?rand=&lt;?php echo rand();?&gt;" id='captchaimg'&gt;&lt;br/&gt;
  </code></pre>
  
  <p>PHP validation: (works perfectly) </p>
  
  <pre><code>if(strcasecmp($_SESSION['code'], $_POST['captcha']) != 0){
    //----mismatch values
  }
  </code></pre>
  
  <p>But the same thing in js I have tried like</p>
  
  <pre><code>var session = &lt;?php echo $_SESSION['code'] ?&gt;;  // this value is different 
                                                  // from captcha image
  </code></pre>
  
  <p>Is it possible to validate captcha before submitting the form in Javascript/jQuery?</p>