responseText from php coming with a new line character
Posted: Mon May 05, 2008 6:30 am
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
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