07/07/2006, 23:10
|
| | | Fecha de Ingreso: enero-2006 Ubicación: Monterrey,Mexico
Mensajes: 952
Antigüedad: 18 años, 3 meses Puntos: 3 | |
Funciones de Ajax: Código PHP: <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(datasource,divID){ var contenedor; var otro; contenedor = document.getElementById(divID); ajax=nuevoAjax(); var nombre =document.form.r_alum.value //Esta variable obtiene el valor de lo q puso el usuario en el textbox nombre ajax.open("GET", "valida.php?"+"&"+"nombre="+nombre,true); ajax.onreadystatechange=function() { if (ajax.readyState==4) { contenedor.innerHTML = ajax.responseText } } ajax.send(null) } </script> <body> <center></center> <div id="contenedor"> //aqui el formulario.// <input type =submit value = "Manda un email" onclick ="cargarContenido('valida.php','contenedor')"> </div> valida.php: Código PHP: $nombre=$_GET['nombre'];//USA GET EN TU FORM... //Aqui tendras el script donde checas si hay disponiblidad del RUN... si lo encuentra en la BD, pones codigo HTML y generas el formulario con el contenido de los registros, como ya lo tenias .... //Supongo q ya sabes como hacer el query tomando como parametros un dato del textbox //Esa es la idea, solo adaptalo a tu proyecto.. Espero te sirva..
Saludos..
__________________ -URL= Go PHP5.
-Age=22.
-Learning=PHP,J2EE,Struts,MAMBO,C++,JSON,AJAX,XHTML ,CSS. |