I have an index.html page that makes an AJAX request to a PHP page; the expected return is JSON. The code seems to work well. However for some random reason, my PHP file sometimes returns <!-- end of php tag--> before the json text.
The return that breaks the program looks like this:
<!-- end of php tag-->{"success":true,"message":"Informacion registrada. Porfavor verifica su telefono."}
That html comment breaks the whole thing. The index.html file can’t process the file correctly when that comment is returned. I have no idea why that comment gets returned or where it comes from. Its not in any of my code… and when I troubleshoot it, it seems to go away. But then I submit different values and it comes back… Very weird behavior..
Any insight is greatly appreciated!
I would expect you have something like this somewhere:
Everything outside of the
<?phpand?>tags will get output to the browser.Find it and delete it.