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:
"{"firstname":"levi","secondname":"johnson"}<!DOCTYPE html><html><head>"
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.