title: How can I get a PHP variable to AJAX?
body: <p>I don't think I am passing the variable the right way between my separate PHP and AJAX files.</p>
  
  <p>I am debugging this by triggering the second condition <code>$status = 'info';</code> in my PHP file. </p>
  
  <p>Currently, <code>status</code> is coming up as "undefined" for <code>alert(data.status);</code></p>
  
  <p>signup_process.php</p>
  
  <pre><code>if (condition){
  
     $status = 'success';
  
  else {
  
      $status = 'info';
  
      }
  </code></pre>
  
  <p>AJAX</p>
  
  <pre><code>function send() {
  var data = $('#signup_form').serialize();
      $.ajax({
          type: "POST",
          url: "signup_process.php",
          data: data,
          success: function (data) {
          alert(data.status);
              if (data.status == 'success') {
                  // everything went alright, submit
                  $('#signup_form').submit();
              } else if (data.status == 'info')
              {
                  console.log(data.status);
                  $("label#email_error").show(); 
                  return false; 
              }
          }
      });
      return false;
  };
  </code></pre>
  
  <p>I know that the 2nd condition is being triggered because I put a header redirect there just for testing and it worked fine.</p>