Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/02/2014, 12:31
Avatar de rottenp4nx
rottenp4nx
 
Fecha de Ingreso: octubre-2012
Ubicación: Santiago
Mensajes: 417
Antigüedad: 11 años, 6 meses
Puntos: 36
Respuesta: checkbox con ajax

Código Javascript:
Ver original
  1. $(".clase_insertar").submit(function(event){
  2.         event.preventDefault();
  3.  
  4.         var d=$(this).find("#destacado").is(':checked');
  5.  
  6.         $.ajax({
  7.             async:true,
  8.             type: "POST",
  9.             dataType: "html",
  10.             contentType: "application/x-www-form-urlencoded",
  11.             url: "insertar.php",
  12.            
  13.             data:{destacado:d},
  14.            
  15.             error: function(jqXHR, textStatus){
  16.             alert("Se produjo un error: " + textStatus);
  17.             }
  18.         });
  19.  
  20.     });

Código PHP:
Ver original
  1. if ($_POST['destacado'] == true) { $destacado = "si"; } else { $destacado = "no"; }
  2.  
  3. mysqli_query($conexion,"INSERT INTO post (destacado) VALUES ('$destacado')");

Intenta, así.
Saludos