Hi All
I am learning JS and ajax.. successfully writing my own working scripts.. but, being a newbie, still hit the wall alot. Today's wall really has me stumped:
Developing locally, I am calling a page with a working XMLHttpRequest object.. and getting the response, fine. The problem is that the response is coming back with some space chars tacked on. There are like 10-12 space chars prefixed, and one space char suffixed to my response text. Even if I just stick in a single "a" char in the (now static) page that I call, it still returns:
"<space><space><space><space><space><space><space><space><space><space><space>a<space>"
Why?!
Anyway, being a hacker for a living ;-), I attempt to just get around the issue (and understand what happened another day), with something like this:
...
Code:
myResponseTextHack = myObject.responseText;
myResponseTextHack = myResponseTextHack.replace(/ /g,'~');
...which does change *internal* space chars to tilda chars... *BUT* the darn thing STILL has the prefixing and suffixing space chars.
Why?!
Can anyone guide me here?
Thanks so much,
-Govinda