Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/12/2010, 15:34
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: JQuery - Obetener valores de checkboxes y enviarlos con ajax

http://api.jquery.com/serialize/

Código HTML:
Ver original
  1.     <head>
  2.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  3.         <title>Prueba</title>
  4.         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  5.         <script type="text/javascript">
  6.             $(function(){
  7.                 $('#enviar').click( function(){
  8.                     qs = $('form').serialize();
  9.                     alert( qs );
  10.                     return false;
  11.                 });
  12.             });
  13.         </script>
  14.         <style>
  15.  
  16.         </style>
  17.     </head>
  18.     <body>
  19.  
  20.     <table>
  21.         <form action="">
  22.             Numeros:
  23.             <div>
  24.             Uno: <input type="checkbox" name="numero" value="1" />
  25.             Dos: <input type="checkbox" name="numero" value="2" />
  26.             Tres: <input type="checkbox" name="numero" value="3" />
  27.             Cuatro: <input type="checkbox" name="numero" value="4" />
  28.             Cinco: <input type="checkbox" name="numero" value="5" />
  29.             </div>
  30.             Letras:
  31.             <div>
  32.             A: <input type="checkbox" name="letra" value="a" />
  33.             B: <input type="checkbox" name="letra" value="b" />
  34.             C: <input type="checkbox" name="letra" value="c" />
  35.             D: <input type="checkbox" name="letra" value="d" />
  36.             E: <input type="checkbox" name="letra" value="e" />
  37.             </div>
  38.             <input type="submit" id="enviar" value="Enviar" />
  39.         </form>
  40.     </table>
  41.  
  42.     </body>
  43. </html>