Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/12/2014, 03:07
moginn
(Desactivado)
 
Fecha de Ingreso: enero-2013
Mensajes: 289
Antigüedad: 11 años, 2 meses
Puntos: 10
Respuesta: Como capturar valores de checkboxs seleccionados

Cita:
Iniciado por Montes28 Ver Mensaje

Código PHP:
Ver original
  1. @foreach($tipos as $tipo)
  2. <input type="checkbox" name="estaciones[]" value="{{ $tipo->id }}" id="{{ $tipo->id }}">{{ $tipo->nombre }} <br>
  3. @endforeach
Código PHP:
    $(function(){
             $(
'input[type="checkbox"]').change(function(){
     var 
checkboxValues = new Array();
        $(
':checkbox:checked').each(function() {
              var 
id=$(this).attr('id');
       
              var 
value=$(this).val();
              if ($(
this).prop('checked')){
                  
checkboxValues.push($(this).val());
              }
            });
      $.
ajax({
          
type"POST",
          
url"index.php",
          
data: {infocheckboxValues },
          
success: function (result) {
          
//do somthing here
          
}
    });
    }); 

Última edición por moginn; 25/12/2014 a las 03:38