Ver Mensaje Individual
  #13 (permalink)  
Antiguo 09/01/2008, 12:55
manriquez
 
Fecha de Ingreso: enero-2008
Mensajes: 30
Antigüedad: 16 años, 4 meses
Puntos: 0
Re: Como enviar un array u objeto mediante xajax?

procesa_datos.php

Código PHP:
<script type="text/JavaScript" src="prototype.js"
function 
envia_datos(){
   var 
capa = $('micapa'); //esto es equivalente a document.getElementById('id_capa')
   
var nombre = $('nombre').value;
   var 
apellido = $('apellido').value;
   var 
pars 'nombre=' nombre '&Apellido=' apellido;
   if (!
capa) return false;
    new 
Ajax.Updater(capa'procesa_datos2.php'{
        
method'get',
        
parameterspars
    
});

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form action="procesa_datos2.php" method="get">
<table width="60%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>Nombre</td>
    <td><label>
      <input type="text" name="nombre" id="nombre" />
    </label></td>
  </tr>
  <tr>
    <td>Apellido</td>
    <td><label>
      <input type="text" name="apellido" id="apellido" />
    </label></td>
  </tr>
  <tr>
    <td><label>
      <input type="button" name="button" id="button" value="Enviar" onClick="envia_datos()" />
    </label></td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
<div id="micapa"></div>
</body>
</html> 
procesa_datos2.php
Código PHP:
<?
echo "Nombre: " $_GET['nombre'] . "<br>Apellido: " $_GET['apellido'];
?>
Hice lo del & pero aun nada.