Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/09/2005, 09:45
Avatar de richardinj
richardinj
 
Fecha de Ingreso: enero-2005
Ubicación: Ciber Espacio
Mensajes: 2.180
Antigüedad: 19 años, 3 meses
Puntos: 11
AJAX solo funciona una ves?

Hola use en ejemplo de un post publicado aqui y me funciona normal... el ejemplo es simple.. doy click en un boton y me me devuelve el IP ... bueno.. si doy otra ves click .,. ya no funciona....

Falta algo.. aca les paso el codigo
Código PHP:
<script language="javascript"  type="text/javascript">
//crear el objeto
function objetus() {
        try {
                
objetus = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (
e) {
                try {
                        
objetus= new ActiveXObject("Microsoft.XMLHTTP");
                } catch (
E) {
                        
objetusfalse;
                }
        }
        if (!
objetus && typeof XMLHttpRequest!='undefined') {
                
objetus = new XMLHttpRequest();
        }
        return 
objetus
}

function 
enviar()
{
    
    
_objetus=objetus()
    
_values_send="funcion=ip";
    
_URL_="dar_ip.php?"
    
_objetus.open("GET",_URL_+_values_send,true);        
    
_objetus.onreadystatechange=function() {              
        if (
_objetus.readyState==4)
        {               
            
window.alert(_objetus.responseText);
        }
    }   
    
_objetus.send(null);
}
</script> 
Código HTML:
<input type='button' value='Ver IP' Onclick="javascript: enviar();"> 


porque ????????????