ciao a tutti

ho un div che si aggiorna ogni tot secondi
se una condizione che sta al suo interno è vera, mi deve reindirizzare da un'altra parte.

il problema che ho riscontrato è che se la condizione è già vera, il redirect me lo fa correttamente,
mentre se la condizione non è vera, e il div continua ad aggiornarsi ogni 3-4 sec, e poi quando la condizione diventa vera il redirect me lo fa solo dentro al div.

io credo che il problema sta nello script che mi aggiorna il div...

ma non riesco a capire dove

Codice PHP:


function Update2()
{
  return 
Request2();
}
window.setInterval("Update2()"3000)
var 
XMLHTTP2;
function 
Request2()
{
var 
noCache2Math.floor(Math.random() * (9999))
  
XMLHTTP2 GetBrowser2(ChangeStatus2);
  
XMLHTTP2.open("GET""prova.php?nocache="+noCache2true);
  

  
XMLHTTP2.send(null);
}
function 
ChangeStatus2()
{
  if (
XMLHTTP2.readyState == 4)
  {
    var 
R2 document.getElementById("prova");
    
R2.innerHTML XMLHTTP2.responseText;
    
    
    

    
    
  }
}
function 
GetBrowser2(FindBrowser2)
{
  if (
navigator.userAgent.indexOf("MSIE") != (-1))
  {
    var 
Class2 "Msxml2.XMLHTTP";
    if (
navigator.appVersion.indexOf("MSIE 5.5") != (-1));
    {
      
Class2 "Microsoft.XMLHTTP";
    } 
    try
    {
      
ObjXMLHTTP2 = new ActiveXObject(Class2);
      
ObjXMLHTTP2.onreadystatechange FindBrowser2;
      return 
ObjXMLHTTP2;
    }
    catch(
e)
    {
      
alert("attenzione: l'ActiveX non sarà eseguito!");
    }
  }
  else if (
navigator.userAgent.indexOf("Mozilla") != (-1))
  {
    
ObjXMLHTTP2 = new XMLHttpRequest();
    
ObjXMLHTTP2.onload FindBrowser2;
    
ObjXMLHTTP2.onerror FindBrowser2;
    return 
ObjXMLHTTP2;
  }
  else
  {
    
alert("L'esempio non funziona con altri browser!");
  }


aiuto sono giorni che ci sbatto la testa