Jump to content


Photo

orientacion en envio de formulario con ajax


  • Please log in to reply
No replies to this topic

#1 jooz

jooz

    Member

  • Miembros
  • PipPip
  • 45 posts

Posted 25 May 2013 - 10:17 PM

buenas noches compañeros.....
nuevamente ando con un pequeño problema que estoy seguro ustedes me podran ayudar ya para ustedes debe ser super facil pero para uno que apenas aprende nos deja sin neuronas... jejejeje... bueno lo que trato de hacer es enviar un formulario por ajax con la funcion de nuestro amigo y maestro Cesar Cancino pero no se como hacerlo....... :embarrassed:
el codigo de ajax es el siguiente:
[js]
//********************************************************************************************************
function obtiene_http_request()
{
var req = false;
try
{
  req = new XMLHttpRequest(); /*p.e. Firefox */
}
catch (err1)
{
try
{
req = new ActiveXObject ("Msxml2.XMLHTTP");
/*ALGUNAS VESIONES IE*/
}
catch (err2)
{
try
{
req = new ActiveXObject ("Microsoft.XMLHTTP");
/*ALGUNAS VESIONES IE*/
}
catch (err3)
{
req = false;
}
}
}
return req;
}
var miPeticion = obtiene_http_request();
//********************************************************************************************************
function from (id,ide,url){
var mi_aleatorio=parseInt(Math.random()*99999999);//para que no guarde la pag en el cache...
var vinculo=url+"?id="+id+"&rand="+mi_aleatorio;
//alert(id);
miPeticion.open("GET",vinculo,true);//ponemos true para que la peticion sea asincronica
miPeticion.onreadystatechange=miPeticion.onreadystatechange=function(){
if (miPeticion.readyState==4)
{
//alert(miPeticion.Status);
if (miPeticion.status==200)
{
//alert(miPeticion.status);
var http=miPeticion.responseText;
//alert(http);
document.getElementById(ide).innerHTML=http;

}
} else {
//document.getElementById(ide).innerHTML="<img src='images/loading2.gif' />";
}
}
miPeticion.send(null);
}
[/js]


y lo que intento enviar es esto

<form id="form" name="form">

<?php
//print_r($_GET['id']);
if(strlen($_GET['id']!=NULL))
{
for ($i=0;$i<$_GET['id'];$i++)
{
echo "<input type='text'  name='$i' id='$i' size='3'>";

}
}
?>




</form>
<a href="javascript:void(0)"
onClick="from(document.form,'cargar_datos','proc_carga_datos.php')"> Enviar</a> 



muchas gracias por su ayuda :wink:.......

  • 0




IP.Board spam blocked by CleanTalk.