title: How to use ajax to verify and submit a form on successful verification?
body: <p>I am trying to submit a form after its captcha check. I am using the <a href="https://www.phpcaptcha.org/" rel="nofollow noreferrer">Securimage</a> module as the captcha module.</p>
  
  <p>I am trying verify and submit the form using <code>onsubmit</code> method and using ajax call to verify the captcha. I can check but unable to submit on successful captcha check. </p>
  
  <p>Here is my jquery function:</p>
  
  <pre><code>function processForm()
      {
          var captcha = $("#captcha_code1").val();
          jQuery.ajax({
              url: 'resources/qform/captcha_check.php',
              type: 'POST',
              data: {captcha_code: captcha},
              dataType: 'json'
          }).done(function(data) {
              if (data.error === 0){
                  alert('submit successful');
                  return true;
              }else{
                  alert("There was an error with your submission.\n\n" + data.message);
                  jQuery('#captcha_code1').val('');
                  return false;
              }
          });
  
          return false;
      }
  </code></pre>
  
  <p>The above code returns 'submit successful' alert on successful chptcha check but unable to submit form. So, Is it possible to do the both and if yes, then how?</p>