Salve a tutti...
ho creato una piccola chat con php e AJAX (di cui sono un novellino....)
Ho testato il sito con Google Chrome e Mozzilla Firefox e fin qui nessun problema...
poi ho provato con Explorer 8... ed ecco che il codice per aggiornare la pagina in AJAX non funziona...
codice:
function Update()
{
return Request();
}
window.setInterval("Update()", 3000)
var XMLHTTP;
function Request()
{
XMLHTTP = GetBrowser(ChangeStatus);
XMLHTTP.open("GET", "ajax.php", true);
XMLHTTP.send(null);
}
function ChangeStatus()
{
if (XMLHTTP.readyState == 4)
{
var R = document.getElementById("CHAT");
R.innerHTML = XMLHTTP.responseText;
}
}
function GetBrowser(FindBrowser)
{
if (navigator.userAgent.indexOf("MSIE") != (-1))
{
var Class = "Msxml2.XMLHTTP";
if (navigator.appVersion.indexOf("MSIE 5.5") != (-1));
{
Class = "Microsoft.XMLHTTP";
}
try
{
ObjXMLHTTP = new ActiveXObject(Class);
ObjXMLHTTP.onreadystatechange = FindBrowser;
return ObjXMLHTTP;
}
catch(e)
{
alert("attenzione: l'ActiveX non sarà eseguito!");
}
}
else if (navigator.userAgent.indexOf("Mozilla") != (-1))
{
ObjXMLHTTP = new XMLHttpRequest();
ObjXMLHTTP.onload = FindBrowser;
ObjXMLHTTP.onerror = FindBrowser;
return ObjXMLHTTP;
}
else
{
alert("L'esempio non funziona con altri browser!");
}
}
questo è il codice... qualcuno sa come aiutarmi??