title: jQuery Ajax success function data is null?
body: <p>I am novice to <code>ajax/php</code> and learning it. I am trying to pass php values through <code>ajax</code> which is successful however I am not able to get response variable from the php file to <code>ajax</code>. Although <code>ajax</code> is successful, why the data or result or response from php is <code>NULL</code>. Is there anything missing here, which I am not able to understand. Please help!</p>
  
  <pre><code>$(document).ready(function(){
  $('#regform').submit(function(){
       var form = $(this),
       formData = form.serialize(),
       formUrl = form.attr('action'),
       formMethod = form.attr('method'), 
  
       $.ajax({
           url: formUrl,
           type: formMethod,
           data: formData,
           success:function(result){
                  console.log(result)    =====&gt; why its is NULL? 
                  console.log(result.status);   ======&gt;Uncaught TypeError: Cannot read 
  
         }
    });
  
  });  })
  </code></pre>
  
  <p>HTML5 file as:</p>
  
  <pre><code>&lt;form id="regform" method="post" action="process.php"&gt;
  &lt;fieldset&gt;
  &lt;label for="firstName"&gt;First Name&lt;span style="color:red;"&gt;&amp;#42;&lt;/span&gt;&lt;/label&gt;
  &lt;input type="text" id="firstName" name="firstName" placeholder="First Name" required&gt;
  &lt;label for="Company"&gt;Company&lt;/label&gt;
  &lt;input type="text" id="Company" placeholder="" name="Company"&gt;
  &lt;label for="telephone"&gt;Phone Number&lt;/label&gt;
  &lt;input type="tel" id="telephone" name="telephone"&gt;
  &lt;label for="email"&gt;Email&lt;span style="color:red;"&gt;&amp;#42;&lt;/span&gt;&lt;/label&gt;
  &lt;input type="email" id="email" pattern="([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})" name="email" placeholder="example@domain.com" required&gt;
  &lt;input name="submit" id="submit" tabindex="5" value="Register" type="submit"&gt; 
  &lt;/fieldset&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>And php file :<strong>process.php</strong></p>
  
  <pre><code>         $status="Success!!!";
           $message="You are welcome";
  
           $data = array(
              'status' =&gt; $status,
              'message' =&gt; $message
          );
          header('Content-Type: application/json');
          echo json_encode($data);
                      exit;
  </code></pre>
  
  <p>Any help, directions, insight on the problem/solution would be much more appreciated. Thank you in Advance.</p>