I am using XMLHttpRequest
to get some data from my server. I use the first letter as a flag for error or success. This was working fine but after a point while not changing anything on server or php configuration, the request started to return white space first character. I dealed with it by trimming it, but I am wondering how this could happen. If anybody can help I would really appreciate it. I can give some money also for deeper investigations. In my PHP file that is called from javascript. I use const value for true or false flag which is 0 and 1. Something goes wrong and before this const variable a whitespace is being echoed.Is it php echoing it or javascript changed behaviour and is adding whitespace in XMLHttpRequest
response?
Either track down where the whitespace is coming from or call phps ob_clean
From the manual
This function discards the contents of the output buffer.
This function does not destroy the output buffer like ob_end_clean() does.
The output buffer must be started by ob_start() with PHP_OUTPUT_HANDLER_CLEANABLE flag. Otherwise ob_clean() will not work.