title: Getting parseerror while receiving response from json_encode using $.ajax
body: <p>I'm trying to try a pretty simple request and get response thing using $.ajax via. json. I have tried alot to return a simple text phrase from a php file.
  My js part of code goes like this that calls a beemailer.php to get response.</p>
  
  <pre><code>$.ajax({
          type: 'POST',
          dataType: "json",
          contentType: "application/json; charset=utf-8",
          url: 'beemailer.php',
          data: {
              'name': data_name,
              'email': data_email,
              'message': data_message,
              'subject': data_subject
          },
          success: function (data) {
              var output = jQuery.parseJSON(data);
              console.log(output);
              alert(output);
          },
          error: function (error, x, y) {
              console.log(error);
              alert(x, y);
  
          }
          )
  };
  </code></pre>
  
  <p>And beemailer.php is like this:</p>
  
  <pre><code>&lt;?php
      $to = "ashish_sharma307@hotmail.com";
      $subject = $_POST['subject'];
      $message =$_POST['message'];
      $headers = "From:".$_POST['name']."(".$_POST['email'].")";
      mail($to,$subject,$message,$headers);
      $response = "The mail has been sent. Thank You the valid mail.";
       header("Content-Type: application/json; charset=utf-8", true);
       echo json_encode($response);
  ?&gt;
  </code></pre>
  
  <p>What I need for now is simply to get that $response text get alerted. 
  Any help will be appreciated.</p>