The returned XML response has an empty space

I am trying to fix a mistake for a friend on his site written by someone else, and it is very difficult for me with one of these errors. There is a function to verify that the user can use the username through AJAX, the answer is XML. However, the returned XML has an error in it.

XML Parsing Error: XML or text declaration not at start of entity Location: moz-nullprincipal:{17ec3adb-5ee9-437a-b047-8910f6faa55c} Line Number 2, Column 1:

<?xml version="1.0" encoding="UTF-8"?><ajaxResponse><cunamemsg>1</cunamemsg></aj...
^

When I look at the actual answer, it looks like this:

<?xml version="1.0" encoding="UTF-8"?><ajaxResponse><cunamemsg>1</cunamemsg></ajaxResponse>

It has a white line at the top, which I assume is causing a JS error:

cunameresult.getElementsByTagName(

if(cunameresult.getElementsByTagName('cunamemsg').item(0).firstChild.data==0) 

Honestly, I have no idea what else to check. I checked every PHP script specified for any space.

, PHP , XML ? PHP, script, .

.

+3
1

, <?php - PHP- , - XML.

+6

Source: https://habr.com/ru/post/1771068/


All Articles