title: HTML is being appended at the end of JSON data, how can i separate them?
body: <p>I'm submitting values of a form to another file that processes them but that file also has HTML code in it. I'm echoing json_encode() on that file in order to return the response but the HTML gets appended at the end of the JSON data like this:</p>
  
  <pre><code>"{"firstname":"levi","secondname":"johnson"}&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;"
  </code></pre>
  
  <p>i want them separate as its messing up the JSON data i want to return. when i remove the HTML part of the file it works fine.
  I have tried using a content-type header on the php part but it doesn't help.</p>