Forum Moderators: open

Message Too Old, No Replies

Solution to xmlReq.responseText Extra line

         

zardiw

3:19 am on May 12, 2009 (gmt 0)

10+ Year Member



This code will add a blank line to the top of the text area:

(FrmSmokin is the ID of a Text area in the page)

try {
if (xmlReq.readyState == 4) {
if (xmlReq.status == 200) {

resultText = xmlReq.responseText;

document.getElementById('FrmSmokin').value = resultText;

However, if you add dummy text like this "Void," to the front of your echo response, you can do this, and you won't get a blank line at the top:

try {
if (xmlReq.readyState == 4) {
if (xmlReq.status == 200) {
resultText = xmlReq.responseText.split(",");
//Have to split it cause otherwise it adds a blank line to the top
document.getElementById('FrmSmokin').value = resultText[1];

Took me a while to solve this one..........z

zardiw

4:21 am on May 12, 2009 (gmt 0)

10+ Year Member



OK, you need to use another character for the split....cause a , is way too common. Gonna try ~ .......z