473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

xmlhttp responseText

I have a remarkable problem.
Opening a file using xmlhttp works perfectly.
The responseText output is read, since it can be assigned to an alert() message, as follows : alert(xmlhttp.resposeText)
However, xmlhttp.responseTest can NOT be assigned to a normal string variable, UNLESS the file is already present in the temporary internet folder.
This problem only occurs in the remote webserver context, not on my local system.
It seems that a responseText read directly from the server directory cannot be transformed into a string, whereas one read from a windows directory can.
Is this perhaps a UNIX problem ?
Or is this a restriction by my webserver?

What can I do about this ?

my situation: webbrowser=IE, webserver=chello
Oct 8 '06 #1
1 7362
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 ...
Oct 12 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jason Morehouse | last post by:
Hello, Anyone know if it's possible to speak with the server via xmlhttp.open while the browser is doing a post -- file upload in this case: <form enctype="multipart/form-data"...
9
by: fochie | last post by:
Greetings, I'm having a problem when I try to GET a file from my server via xmlhttp when using Mozilla. With IE I can get any type of file fine, get/display headers fine, etc. With Mozilla,...
8
by: Marcos | last post by:
Hello, Is possible to determine the timeout of XMLHTTP Request? My solicitations using the XMLHTTP they are giving error and this because the page it is delaying a little more to send the...
5
by: hatsumoto | last post by:
Hello, I create an ActiveXObject("Msxml2.XMLHTTP") from my HTML page to submit (i.e. post) XML to a server. I can see the content of the XML response via javascript alert(xmlhttp.responseText)....
9
by: balakrishnan.dinesh | last post by:
hi friends, Exactly what i want to know is, In my product we are using xmlhttp request to retrive some data from the server, And Im using IE browser, its working fine in IE. Now i want to work...
1
by: farghal | last post by:
Hello as many people I'm new to ajax but trying my best to understand. At this point I got a problem I'm not able to solve. I've looked on several forums and googled internet but I can't find a...
3
by: Andrewh | last post by:
Hi, I am having a bit of a problem with using xmlhttp. The code of the javascript file is shown below used in Windows XP. var xmlhttp = null; function SetURLDiv(url) { if...
21
vikas251074
by: vikas251074 | last post by:
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support...
2
by: trpost | last post by:
Is it possible to execute javascript as passed in xmlHttp.responseText Here is what I am doing: search.js var xmlHttp xmlHttp=GetXmlHttpObject() var url="search.php"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.