I need help my Ajax script won't work in IE

  • Thread starter funkychicken818
  • Start date
F

funkychicken818

This is the script.

var reqTopCont;
var reqBotCont;

function changeTopContent(newUrl)
{
reqTopCont = false;
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
try {
reqTopCont = new XMLHttpRequest();
} catch(e) {
reqTopCont = false;
}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
try {
reqTopCont = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
reqTopCont = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
reqTopCont = false;
}
}
}
if (reqTopCont) {
reqTopCont.onreadystatechange = reqTopContUpdate;
reqTopCont.open("GET", newUrl, true);
reqTopCont.send("");
}
}

function changeBottomContent(newUrl)
{
reqBotCont = false;
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
try {
reqBotCont = new XMLHttpRequest();
} catch(e) {
reqBotCont = false;
}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
try {
reqBotCont = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
reqBotCont = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
reqBotCont = false;
}
}
}
if (reqBotCont) {
reqBotCont.onreadystatechange = reqBotContUpdate;
reqBotCont.open("GET", newUrl, true);
reqBotCont.send("");
}
}

function reqTopContUpdate()
{
if (reqTopCont.readyState == 4 && reqTopCont.status == 200) {
alert (reqTopCont.responseText);
document.getElementById("topContent").innerHTML =
reqTopCont.responseText;
}
}

function reqBotContUpdate()
{
if (reqBotCont.readyState == 4 && reqBotCont.status == 200)
document.getElementById("bottomContent").innerHTML =
reqBotCont.responseText;
}
 
R

Randy Webb

(e-mail address removed) said the following on 5/7/2006 3:52 PM:
This is the script.

What about it? You have 4 functions, with no call to any of them, what
did you leave out?

You may want to read the group FAQ with regards to the XMLHTTPRequest
object, in the page that is linked to from the FAQ. And then, don't
assume that readers can see the Subject line, and you may want to
include the HTML that goes with the script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top