Q:

Blank response from jQuery Ajax call to PHP script

I hope this isn't a duplicate; the other similar questions I read didn't help me solve my problem.
I'm receiving a blank response (i.e. data = "") from a jQuery Ajax call to my PHP script, used to validate a user's submitted CAPTCHA value. I'm using Cryptographp for my CAPTCHA, and it works as expected, so I'm thinking it's most likely an error either in my Ajax call or the PHP script.
Firebug showing correct POST values ('code' is the submitted CAPTCHA value to test):
code      a
email     a@a.com
emailtext a
firstname a
lastname  a
phone     

Ajax function called onsubmit to determine whether or not to submit the form:
function validateCaptcha()
{
  // Assume an invalid CAPTCHA
  var valid = false;

  // The form containing the CAPTCHA value
  var data_string = $('form#emailform').serialize();

  // Make the Ajax call
  $.ajax({
    url: "captcha.php",
    data: data_string,
    type: "POST",
    async: false,
    success: function (data) {
      if (data == "true")
      {
        valid = true;
      }

      alert ("data: " + data);
    }
  });

  return valid;
}

captcha.php
<?
  $cryptinstall="crypt/cryptographp.fct.php";
  include $cryptinstall;

  // Begin the session
  session_start();

  //Check if CAPTCHA values match
  if(chk_crypt($_POST["code"]))
    return true;
  else
    return false;
?>

My expectation is that the above snippet should return a response of simply "true" or "false," but perhaps this is not the case.
Any help pointing out my error would be greatly appreciated!

A:

You need to use "echo" instead of "return" and write is as a string. return is for returning results of functions.
    <?
      $cryptinstall="crypt/cryptographp.fct.php";
      include $cryptinstall;

      // Begin the session
      session_start();

      //Check if CAPTCHA values match
      if(chk_crypt($_POST["code"]))
        echo "true";
      else
        echo "false;
    ?>

