Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/04/2006, 16:24
Avatar de B**
B**
 
Fecha de Ingreso: enero-2006
Ubicación: Monterrey,Mexico
Mensajes: 952
Antigüedad: 18 años, 3 meses
Puntos: 3
Gracias jcxnet, pero aunque le ponga los parametros, me sigue llevando valor vacio a la base de datos:
Código PHP:
                               <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<
html>
<
head>
<
title>AjaxEjemplo 1 Carga externa de datos</title>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</
head>
                    <
script language="javascript">
                    function 
nuevoAjax(){
                    var 
xmlhttp=false;
                     try {
                      
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                     } catch (
e) {
                      try {
                       
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                      } catch (
E) {
                       
xmlhttp false;
                      }
                     }

                    if (!
xmlhttp && typeof XMLHttpRequest!='undefined') {
                      
xmlhttp = new XMLHttpRequest();
                    }
                    return 
xmlhttp;
                    }

                    function 
cargarContenido(){
                        var 
contenedor;
                        var 
nombre;
                        
contenedor document.getElementById('contenedor');
                        
contenedor.innerHTML '< center><img src="loader.gif" /> </center>';
                        
nametext =document.myform.texto1.value;
                        
ajax=nuevoAjax();
                        
ajax.open("GET","bd.php?"+"&"+"nombre=nametext",true);

                        
ajax.onreadystatechange=function() {
                         if (
ajax.readyState==4) {
                            
contenedor.innerHTML ajax.responseText
                            
}
                        }
                    
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
                    
ajax.send(null)
                    }

                    
</script>
                    <style type="text/css">

                #contenedor{
                border: 5px solid #f00;
                padding: 10px;
        margin: 14px;
    }
    </style>
<body>


           <center><input type =submit value = "Manda un email" onclick ="cargarContenido()"></center>

               <form name ="myform" method="GET" onSubmit = "cargarContenido();return false">
                    <div><input type="text" id="texto1"></div>
                    <div> <input type=submit value="ENVIAR" onPress="cargarContenido()"> </div>
               </form>

        <div id="contenedor">


        </div>



</body>
</html>