![]() |
problemas al usar post hola soy un principiante en esto de ajax pero e estado leyendo unos tutoriales y me arme un codigo pero el problema es que cuando hago funcionar la funcion paresiera que no mandara las variables al php en el servidor bueno aqui esta mi codigo: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Ajax</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script> var navegador; function ajax(){ if (window.ActiveXObject){ navegador = new XMLHttpRequest(); navegador.onreadystatechange = cargar(); var v1 = document.for1.c1.value; navegador.open("POST", php.php,true) navegador.send(v1) } } function cargar(){ var contenido = document.getElementById("contenido"); if(navegador.readyState == 4){ contenido.innerHTML = navegador.responseText; } else { contenido.innerHTML = 'Cargando...'; } } </script> </head> <body> <form onSubmit="ajax()" name="for1"> <div><input type="text" name="c1" /></div> <div><input type="submit" value="enviar" /></div> </form> <div id="contenido"></div> </body> </html> y este es el php: <?php $var = $_GET; $var2 = $_POST; print_r($var); print_r($var2); ?> |
Re: problemas al usar post intenta modificar la siguiente linea var v1 = document.for1.c1.value; de esta manera var v1 = "var="+document.for1.c1.value; have funnnnnnnnn :adios: |
Re: problemas al usar post loading......... Este es un POST REPETIDO. pero te dije, ESTAS USANDO MAL EL METODO READYSATE!!! Código: navegador.onreadystatechange = cargar();
connection closed. |
| La zona horaria es GMT -6. Ahora son las 08:49. |
Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.