472,353 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Problems with IE returning nothing in responseText

I have this little bit of code :
var request = false;
var divid = 0;
var fforie;
try {
request = new XMLHttpRequest();
fforie = "FF";
} catch (trymicrosoft) {
try {
//request = new ActiveXObject("Microsoft.XMLHTTP");
request = new ActiveXObject("Msxml2.XMLHTTP");
fforie = "IE";
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
fforie = "IE";
} catch (failed) {
request = false;
}
}
}
if (!request)
alert("Error initializing XMLHttpRequest!");
function getThreadMessage(parentid) {
divid = parentid;
if(document.getElementById("link" +
divid).innerHTML.indexOf("forum_expand.gif") 0) {
document.getElementById("loadingdiv"+parentid).sty le.visibility
= "visible";
if(document.getElementById("srchon").value == "YES") {
var url =
"forum_api.asp?pageaction=GETLEVEL&forumid=<%=requ est("forumid")
%>&parentid=" + parentid + "&srch=" +
document.getElementById("srchterm").value;
} else {
var url =
"forum_api.asp?pageaction=GETLEVEL&forumid=<%=requ est("forumid")
%>&parentid=" + parentid;
}
request.open("GET", url, true);
request.onreadystatechange = updatePage;
request.send(null);
} else {
if(divid 0) {
document.getElementById("link" + divid).innerHTML = '<img
src="images/forum_expand.gif" border="0">';
}
document.getElementById("thread" + divid).innerHTML = "";
}
}
function updatePage() {
if(request.readyState == 4){
if(request.status == 200) {
if(fforie == "FF") {
document.getElementById("thread"+ divid).innerHTML =
request.responseText;
} else {

alert(request.responseText);

request.responseXML;
}
if(divid 0) {
document.getElementById("link" + divid).innerHTML =
'<img src="images/forum_collapse.gif" border="0">';

document.getElementById("loadingdiv"+divid).style. visibility =
"hidden";
}
}
}
}

It works great in Firefox - returns some HTML code, exactly as planned.
But in IE, responseText returns nothing and causes an alert that says I
have received a system error, and responseBody returns a huge set of
garbage characters.

What am I doing wrong? I have tried replacing "Msxml2.XMLHTTP" with
"Msxml2.XMLHTTP.5.0" (Another person suggested that) and it doesn't
work....

Help!!!

Sep 13 '06 #1
5 8755


furby wrote:
But in IE, responseText returns nothing and causes an alert that says I
have received a system error, and responseBody returns a huge set of
garbage characters.
What is the encoding of the HTML the server sends? MSXML tries to decode
the response body as UTF-8 to build responseText.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 13 '06 #2
I just did a getAllResponseHeaders() and it returned :
"X-Powered-By: ASP.NET Content-Length: 12906 Content-Type: text/html;
charset=65001"

What I am trying to return is an ASP code generated table (Not even a
whole web page) that I then try to paste into a <DIVin the page that
calls it...
Martin Honnen wrote:
furby wrote:
But in IE, responseText returns nothing and causes an alert that says I
have received a system error, and responseBody returns a huge set of
garbage characters.

What is the encoding of the HTML the server sends? MSXML tries to decode
the response body as UTF-8 to build responseText.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 13 '06 #3
I have discovered that it will work in IE if I use "Msxml2.XMLHTTP.4.0"
rather than just a generic "Msxml2.XMLHTTP"....

furby wrote:
I have this little bit of code :
var request = false;
var divid = 0;
var fforie;
try {
request = new XMLHttpRequest();
fforie = "FF";
} catch (trymicrosoft) {
try {
//request = new ActiveXObject("Microsoft.XMLHTTP");
request = new ActiveXObject("Msxml2.XMLHTTP");
fforie = "IE";
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
fforie = "IE";
} catch (failed) {
request = false;
}
}
}
if (!request)
alert("Error initializing XMLHttpRequest!");
function getThreadMessage(parentid) {
divid = parentid;
if(document.getElementById("link" +
divid).innerHTML.indexOf("forum_expand.gif") 0) {
document.getElementById("loadingdiv"+parentid).sty le.visibility
= "visible";
if(document.getElementById("srchon").value == "YES") {
var url =
"forum_api.asp?pageaction=GETLEVEL&forumid=<%=requ est("forumid")
%>&parentid=" + parentid + "&srch=" +
document.getElementById("srchterm").value;
} else {
var url =
"forum_api.asp?pageaction=GETLEVEL&forumid=<%=requ est("forumid")
%>&parentid=" + parentid;
}
request.open("GET", url, true);
request.onreadystatechange = updatePage;
request.send(null);
} else {
if(divid 0) {
document.getElementById("link" + divid).innerHTML = '<img
src="images/forum_expand.gif" border="0">';
}
document.getElementById("thread" + divid).innerHTML = "";
}
}
function updatePage() {
if(request.readyState == 4){
if(request.status == 200) {
if(fforie == "FF") {
document.getElementById("thread"+ divid).innerHTML =
request.responseText;
} else {

alert(request.responseText);

request.responseXML;
}
if(divid 0) {
document.getElementById("link" + divid).innerHTML =
'<img src="images/forum_collapse.gif" border="0">';

document.getElementById("loadingdiv"+divid).style. visibility =
"hidden";
}
}
}
}

It works great in Firefox - returns some HTML code, exactly as planned.
But in IE, responseText returns nothing and causes an alert that says I
have received a system error, and responseBody returns a huge set of
garbage characters.

What am I doing wrong? I have tried replacing "Msxml2.XMLHTTP" with
"Msxml2.XMLHTTP.5.0" (Another person suggested that) and it doesn't
work....

Help!!!
Sep 13 '06 #4


furby wrote:
I have discovered that it will work in IE if I use "Msxml2.XMLHTTP.4.0"
Only that is part of MSXML 4 and not generally installed with IE. So
that will work if the browser user is on a system where MSXML 4 was
installed additionally but otherwise not.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 14 '06 #5
That's weird. I just took a clean laptop, installed IE 6.0.2900.2180 on
it and it works perfectly...
Martin Honnen wrote:
furby wrote:
I have discovered that it will work in IE if I use "Msxml2.XMLHTTP.4.0"

Only that is part of MSXML 4 and not generally installed with IE. So
that will work if the browser user is on a system where MSXML 4 was
installed additionally but otherwise not.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 18 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ehilario | last post by:
Hello everyone, I am trying to access a webservice to post some values via MSXML2.ServerXMLHttp The OS used is win2003 on both machines. When...
5
by: dandiebolt | last post by:
Using xmlhttp I am accessing a document from the web that is not xml and is in fact not even proper html even though it is supposed to be...
21
by: Doug Lerner | last post by:
I'm working on a client/server app that seems to work fine in OS Firefox and Windows IE and Firefox. However, in OS X Safari, although the...
3
by: Noozer | last post by:
Hrm.. last posting was mangled. Let's try again, with more detail... I'm just starting to try out "Ajax" web programming and I've got a question....
9
by: Phil_Harvey | last post by:
I am redoing my website and trying to get it to do something more exciting using Javascript. I did normal Java at university and code at work in...
2
by: paulfe4 | last post by:
i have an ajax request, where the server is returning: {"PageDef": { "pageName": "myname", "queryName": "myqueryname", "queryCtName":...
2
by: mosesdinakaran | last post by:
Hi everybody, Today I faced a problem where I am very confused and I could not solve it and I am posting here.... My question is Is is...
5
by: salvador | last post by:
I'm trying to create a function to return some values from a php script. The php script is returning the correct values if called from a browser...
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....
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.