Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/05/2011, 16:18
ZeThito
 
Fecha de Ingreso: septiembre-2010
Mensajes: 147
Antigüedad: 13 años, 7 meses
Puntos: 3
Respuesta: metodo que me ayude a enviar muchos datos de un formulario con jquery

Me respondo con la solución: (Metodo serialize)
Código Javascript:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  5.  <title>Serialize jQuery Demo</title>
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  7. <script type="text/javascript">
  8.  $(document).ready(function(){
  9.  $("#formulario").submit(function(){
  10.  var cadena = $(this).serialize();
  11.  alert(cadena);
  12.  return false;
  13.  });
  14.  });
  15. </script>
  16. </head>
  17. <body>
  18. <form action="#" id="formulario">
  19. <label for="nombre">Nombre:</label>
  20. <input type="text" name="nombre" id="nombre"/><br />
  21. <label for="email">E-mail:</label>
  22. <input type="text" name="email" id="email"/><br />
  23. <label for="asunto">Asunto:</label>
  24. <input type="text" name="asunto" id="asunto"/><br />
  25. <label for="msg">Mensaje:</label>
  26. <textarea name="msg" id="msg" cols="5" rows="10" tabindex="4"></textarea><br />
  27. <input type="submit" value="Enviar" />
  28. </form>
  29.  
  30. </body>
  31. </html>