Ver Mensaje Individual
  #15 (permalink)  
Antiguo 23/04/2012, 21:24
Avatar de Nemutagk
Nemutagk
Colaborador
 
Fecha de Ingreso: marzo-2004
Ubicación: México
Mensajes: 2.633
Antigüedad: 20 años, 1 mes
Puntos: 406
Respuesta: Envio de correo a varios destinatarios con phpMailer

¬¬ vamos amigo, no te cuesta nada analizar el código y agregar una validación mas, no quieras todo funcionando al 100% para solo hacer copy/paste...

lo que hace falta es verificar el nombre del checkbox para que modifique o no la marcación...

Código Javascript:
Ver original
  1. $(document).on('ready',function() {
  2.                 $('#chk_todos').on('click', function() {
  3.                     $('input[type=checkbox]').each(function() {
  4.                         if ($(this).attr('name') == 'opcion[]') {
  5.                             if ($(this).attr('checked') != 'checked') {
  6.                                 $(this).attr('checked','checked');
  7.                             }else {
  8.                                 $(this).removeAttr('checked');
  9.                             }
  10.                         }
  11.                     });
  12.                 });
  13.                
  14.                 $('#enviar').on('click',function() {
  15.                     var arrayOpt = new Array;
  16.                     $('input[type=checkbox]').each(function() {
  17.                         if ($(this).attr('name') == 'opcion[]') {
  18.                             if ($(this).attr('checked') == 'checked') {
  19.                                 arrayOpt.push($(this).val());
  20.                             }
  21.                         }
  22.                     });
  23.                    
  24.                     $.ajax({
  25.                         url:'http://localhost/demos/checkbox.php',
  26.                         type:'post',
  27.                         data: 'opciones='+arrayOpt,
  28.                         success: function(datos) {
  29.                             $('#respuesta').html(datos);
  30.                         }
  31.                     });
  32.                    
  33.                     return false;
  34.                 });
  35.             });
__________________
Listo?, tendría que tener 60 puntos menos de IQ para considerarme listo!!!
-- Sheldon Cooper
http://twitter.com/nemutagk
PD: No contestaré temas vía mensaje personal =)