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!!! 5 8832
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/
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/
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!!!
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/
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/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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 I access the local machine (A) which has the same...
|
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
(unbalanced tags). Here is the type of code I am using:
...
|
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 UI/communications themselves work
fine, if the...
|
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.
AJAX is fairly straightforward. Javascript...
|
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 VB.NET. I have got reasonably far into what I want...
|
by: paulfe4 |
last post by:
i have an ajax request, where the server is returning:
{"PageDef": {
"pageName": "myname",
"queryName": "myqueryname",
"queryCtName": "myqueryctname"
}};
i have the following code handling...
|
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 possible to return a value to a particular function
...
|
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 window. However, the function that I'm using never...
|
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...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |