I am using the XMLHttpRequest object to load the contents of files into a string variable. My browser IE6 handles this perfecty, but on the server side there's a problem.
Here's the Javascript code meant to read the contents of a file called thisfile.htm in my own domain:
xmlhttp = new XMLHttpRequest();
var sitetxt; var site="thisfile.htm";
xmlhttp.open("GET", site, true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) sitetxt=xmlhttp.responseText;
}
xmlhttp.send();
On the server side the sitetxt value is assigned nothing at all, without even a decent error message.
However, the reponseText value IS actually loaded, since I can show it using an alert(xmlhttp.reponseText) in stead of the sitetxt assignment.
Obviously xmlhttp.responseText output is not in the proper string format, when read from the server directly. The alert() method is known to handle many sorts of variable formats.
There is no problem if thisfile.htm is read from a windows directory, like for instance Temporary Internet Files. So when thisfile.htm is present in the latter directory it will be automatically chosen even from the server side. Usually this means if I execute the thing for a second time, it suddenly works, since thisfile.htm is then copied in the Temp.InternetFiles folder by the browser (IE6)
I have tried many ways to convert the output, such as shortening it, getting unwanted codes out, and even a VBscript BinaryToString() snippet changing responseBody or responseText to a string. But also responseBody appears not to be read as something that can be handled on the server side.
I have searched all the web to get info on this problem. They all come up with wrong codes, that have to be converted. I have tried all of them but none works. The reason it, that you cannot even start to handle to value.
WHAT TO DO ??
This problem should of course not be general Perhaps a quirk in the server of my webhost UPC/Chello ? UNIX problem ?
Please help me if you can ...