Hi ,
I am developing a small web application using php and and mysql.
While making an ajax call , I am getting some extra characters like '\n\r' at the beginning of the responseText.
The php code snippet is shown here :
$response = '';
$response = $response.'yes';
print $response;
************
I alert the responseText using javascript like this :
alert('>>'+httpRequest.responseText+'<<');
The output comes like this :
>>
yes<<
but I expect the output as >>yes<<
I am still clueless as to from where this character is coming in the beginning of the reponse.
debugging with firebug shows some characters like '/n/r' in the responseText.
Can anybody give me some pointers ?
Somebody has also found the same problem before.
http://www.webmasterworld.com/javascript/3462694.htm
nab
responseText from php coming with a new line character
Moderator: General Moderators
Re: responseText from php coming with a new line character
Hi,
Please make sure you don't have any new lines before the <?php tag.
Thos are sent to the browser too.
PuYa
Please make sure you don't have any new lines before the <?php tag.
Thos are sent to the browser too.
PuYa
Re: responseText from php coming with a new line character
I have ensured that there are no new lines before <?php
Still after that while debugging using firebug, the responseText is having the character '\r\n' in the front.
Still after that while debugging using firebug, the responseText is having the character '\r\n' in the front.