Ver Mensaje Individual
  #13 (permalink)  
Antiguo 10/08/2008, 21:23
Avatar de korg1988
korg1988
 
Fecha de Ingreso: junio-2006
Ubicación: Santa Fe, Argentina
Mensajes: 825
Antigüedad: 17 años, 10 meses
Puntos: 19
De acuerdo Respuesta: Me tira el cartel "Cargando" pero no me carga la pagina!

bueno probe como lo dije antes y funciono perfecto, quiza es una buena forma de mantener los diferentes "niveles" que tiene el objeto parece ser! ya que pense que this! se referia a tooda la "class"(supuestamente si lo llamamos asi)" , pero se ve que no tiene alcanze dentro de todos los niveles, igualmente no me queda muy claro del todo!

el codigo me quedo asi
Código PHP:
<html>
<
head>
<
script>
function 
Ajax()
{
    
//--------------------------
    // Variables
    //--------------------------
    
_this this;
    
_this.handler false//Objeto
    //--------------------------
    // Funciones
    //--------------------------
    
_this.conectar = function()
    {
        if(
navigator.appName == "Microsoft Internet Explorer") {
            try {
                
_this.handler = new ActiveXObject('Msxml2.XMLHTTP');
            } catch(
e) {
                try {
                    
_this.handler = new ActiveXObject('Microsoft.XMLHTTP');
                } catch(
e) {}
            }
        } else {
            
_this.handler = new XMLHttpRequest();
        }
    }
    
    
_this.estados = function()
    {
        if(
_this.handler.readyState == 1) {
            
document.getElementById('estado').innerHTML "Cargando...";
        } else if (
_this.handler.readyState == 4) {
            
document.getElementById('estado').innerHTML "Finalizado...";
            
document.getElementById('carga').innerHTML _this.handler.responseText;
        }
    }
    
    
_this.enviar = function(urlmetodoparametros)
    {
        
_this.handler.open(metodourltrue);
        
_this.handler.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        
_this.handler.onreadystatechange _this.estados;
        
        if(
metodo.toUpperCase() == 'POST') {
            
_this.handler.send(parametros);
        } else {
            
_this.handler.send(null);
        }
    }
}

window.onload = function()
{
    
pagina = new Ajax();
    
pagina.conectar();
    
pagina.enviar('prueba.php''GET');
//    cargar("prueba.php", "GET", null, "carga", "estado");
}
</script>
</head>

<body>
<div id="estado">En espera</div>
<div id="carga">Vacio</div>
</body>
</html>