ciao a tutti ho un div che si aggiorna ogni 3 secondi e mi visualizza dei dati prelevati da un database tramite un'altra pagina in php
l'esempio con Mozilla funziona , mentre con IE no
Qualcuno mi può aiutare a farlo funzionare anche con IE?
grazie ciao
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!");
}
}