Hello, first off, let me tell you that yes, i’m new at doing this, but i HAVE tried to do this on my own before asking for help.
I have a basic chat applications of which i’m using AJAX. Its based in an html file, and the results are directed to a div with the id “showchat”.
The javascript file is this:
[CODE]var xmlHttp
function getchat()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert (“Browser does not support HTTP Request”)
return
}
var url=”maintest.php”
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open(“GET”,url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState==”complete”)
{
document.getElementById(“showchat”).innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try { return new XMLHttpRequest(); } catch(e) {}
try { return new ActiveXObject(“Msxml2.XMLHTTP”); } catch (e) {}
try { return new ActiveXObject(“Microsoft.XMLHTTP”); } catch (e) {}
alert(“XMLHttpRequest not supported”);
return null;
return xmlHttp;
}
“maintest.php” simply queries the database for the 25 most recent chats, and prints them out.
This works with the “good” browswers (such as firefox), but not with IE. It gives me the error that “‘xmlhttp’ is undefined”.
Again, i’m new at AJAX, so i dont quite know the ins and outs of how things work differently between browsers.
If you need any other information, just let me know