Stec Records Forum Forum
September 09, 2010, 06:30:13 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
StecRecords.com main page
Contact us
News: This forum is for technical discussions of software and hardware. Posts with inappropriate content will be removed. Spammers Will Be Rejected
 
   Home   Help Search Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Extra lines in response to an AJAX request  (Read 78 times)
bsellon
Chief Administrator
Administrator
Hero Member
*****
Offline Offline

Posts: 614


Time reveals truth.


WWW
« on: June 17, 2010, 03:33:41 PM »

I started noticing extra line feeds showing up at the beginning of some html text that was being written to a textarea field in an AJAX callback.

document.getElementById("myTextAreaField").value = content;

The "content" anything that the requested php file echoed or printed. In my case, the filed included many files, none of which printed or echoed anything outside of a function. Very strange.

I eventually traced the problem to extra line feeds at the bottom of my php files after the ?>

If there was more than one line feed after the ?>, it was added to the response that showed up in the "content" of the callback.  I guess it makes sense; once you are outside of the ?> you are back in raw html.

Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Musician's Friend Product of the Day Save up to 78% During the Scratch 'N' Dent Sale Save Up to $110 at MusiciansFriend.com Fourth of July Special The Radio Kings at CD Baby
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.131 seconds with 21 queries.