Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/04/2006, 00:42
Avatar de B**
B**
 
Fecha de Ingreso: enero-2006
Ubicación: Monterrey,Mexico
Mensajes: 952
Antigüedad: 18 años, 3 meses
Puntos: 3
Leer desde ajax un .php

Hola
Estoy haciendo un ejemplo q tengo en un ebook("Ajax for dummies")...el cual se supone que trae lo q contiene un archivo php..el asunto es que no me hace lo q ellos dicen q hace... no me marca errores el editor... pero no hace nada, el codigo es el siguiente:
Código PHP:

<html>
<
head>
       <
script languaje="javascript">
            var 
Ajaxfalse;
            if(
window.XMLHttpRequest){
              
Ajax= new XMLHttpRequest();
            }
            else if(
window.ActiveXObject){
                
Ajax= new ActiveXObject("Microsoft.XMLHTTP");
            }

            function 
getData(datasource,divID){
              if(
Ajax){
                var 
obj=document.getElementById(divID);
                
Ajax.open("GET",datasource);
                
Ajax.onreadystatechange=function(){
                  if(
Ajax.readystate == && Ajax.status == 200){
                    
obj.innerHTML=Ajax.responsetext;

                  }
                }
            
Ajax.send(null);

              }

            }
    
</script>
</head>
<body>
            <form>
                <input type =submit value = "enseña msg" onclick ="getData('data.php','targetDiv')">
            </form>
            
    <div id="targetDiv">

    </div>

</body>
</html> 
Y lo que tengo en data.php es:
Código PHP:
<?php
    
echo 'Este texto viajo por ajax';
 
?>
Ahhh y los 2 archivos los tengo en el mismo directorio, y lo corro desde el localhost preview de PHP design..


Haber si alguien me puede ayudar...gracias de antemano