Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/03/2016, 16:00
Pablo00000
 
Fecha de Ingreso: diciembre-2013
Ubicación: Yaracuy
Mensajes: 27
Antigüedad: 10 años, 5 meses
Puntos: 0
Respuesta: Problema al cargar table con ajax

ok tenias razon, gracias :3 crei q funcionaba sustituyendo ese codigo el cual contenia el id. pero no me funciona del todo.

Código HTML:
<table id="cargaTabla" class="table table-striped table-bordered" cellspacing="0" width="100%">
                <thead>
                   <tr>
                      <th></th>
                      <th hidden="true">Id</th>
                      <th>Carácter</th>
                      <th>Estado</th>
                   </tr>
                </thead>
                <tbody id="resultado">
                </tbody>
            </table> 
Código PHP:
<?php
    
require '../model/conexion.php';

    if(isset(
$_POST['funcion']) && !empty($_POST['funcion'])) {
        
$funcion $_POST['funcion'];
        switch(
$funcion) {
            case 
'cargarTabla' cargarTabla();break;
            case 
'blah' blah();break;
            
// ...etc...
        
}
    };
    
    function 
cargarTabla(){
                        
$pdo conexion::connect(); 
                        
$sql "SELECT 
                                id, 
                                caracter, 
                                CASE 
                                WHEN status='t' THEN 'activo'
                                WHEN status='f' THEN 'inactivo'
                                ELSE 'error'
                                END AS status

                                FROM tipos_rif ORDER BY caracter"
;
                        
$con 1;
                        foreach (
$pdo->query($sql) as $row) {
?>
                    <tr>
                        <td><?php echo $con?></td>
                        <td hidden="true"><?php echo $row['id']; ?></td>
                        <td><?php echo $row['caracter']; ?></td>
                        <td><input type="checkbox" data-toggle="toggle" onchange="CambiarStatus(<?php echo $row['id']; ?>)" data-on="Activado" data-off="Desactivado" 
                        <?php if($row['status']=="activo"){ ?>
                            checked><label hidden="true">a</label>
                        <?php }else{ ?>
                            ><label hidden="true">b</label>
                        <?php ?>
                        </td>
                    </tr>
<?php
                        $con
++;
                        }
                        
conexion::disconnect();
    }
?>
la tabla no me carga la libreria datatable q estoy usando.. y unos efectos al checkbox.. como sino escuchara el js y el css de bootstrap.. no se si me hace falta llamar algunas cosas.. y donde las debo llamar..