View Full Version : strange ajax responsetext issue

01-08-2009, 11:39 PM
Hopefully a quick question.

in a file I call a function ending with

text = xmlhttp.responseText;
//alert('more: '+text); (commented on purpose for this example)
return text;

(this is an ajaxform submission thing)

in the calling function:

text = ajaxformSP(val, handler, form);
alert('try: '+text);
If I uncomment the alert in the first code snippet, I get an alert with "Try: and the correct response text".

If I leave it commented, the alert 'try '+ text has null or nothing for text.
Anyone have any idea why, and also, Any idea how I can deal with this issue without having to make an alert?

01-09-2009, 06:45 AM

text = xmlhttp.responseText;

part of a function that's called on the xmlhttp.onreadystatechange, and are you testing for xmlhttp.readyState == 4 before assigning the xmlhttp.responseText to text?

01-09-2009, 04:52 PM
Hhh, thanks jscheuer :] I am now. Huge brain fart there.