extra newlines in Ajax responseText added by PHP include

A

abrtlt

I have a simple PHP script that sends a string to
XMLHttpRequestObject.responseText.
responseText as received from the PHP script begins with 2 extra
newline characters (\n\nMyString):

<?php
require_once('DB.php');
require_once('../myDir/myFile.php');
.......
echo('MyString');
?>

myFile.php
<?php
$var1 = 1;
$var2 = 2;
$var3 = 3;
?>

If I manually write the contents of myFile.php into the script, there
are no extra newlines in responseText. (Same behavior with IE/FireFox)
Am I missing something?
Thanks!
Andrew
 
L

Laurent Bugnion

Hi,

I have a simple PHP script that sends a string to
XMLHttpRequestObject.responseText.
responseText as received from the PHP script begins with 2 extra
newline characters (\n\nMyString):

<?php
require_once('DB.php');
require_once('../myDir/myFile.php');
......
echo('MyString');
?>

myFile.php
<?php
$var1 = 1;
$var2 = 2;
$var3 = 3;
?>

If I manually write the contents of myFile.php into the script, there
are no extra newlines in responseText. (Same behavior with IE/FireFox)
Am I missing something?
Thanks!
Andrew

Seems to me that it's not a JavaScript problem, but a PHP problem. I
recommend you to post to the appropriate group.

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top