Example #1
0
         echo json_encode($objtipo_acople->updateDB());
         break;
     case 'del':
         $objtipo_acople->setVar('id', $_POST['id']);
         echo json_encode($objtipo_acople->deleteDB());
         break;
     case 'get':
         $res = $objtipo_acople->searchDB($_POST['id'], 'id', 1);
         if (is_array($res)) {
             echo json_encode($res[0]);
         } else {
             echo json_encode(0);
         }
         break;
     case 'list':
         $res = $objtipo_acople->listDB();
         if (is_array($res)) {
             echo json_encode($res);
         } else {
             echo json_encode(0);
         }
         break;
     case 'search':
         $res = $objtipo_acople->searchDB($_POST['data'], $_POST['value'], $_POST['type']);
         if (is_array($res)) {
             echo json_encode($res);
         } else {
             echo json_encode(0);
         }
         break;
 }
Example #2
0
<div class='control-group'>
    <label>Nombre</label>
    <input class='form-control' placeholder='Nombre' id='nombre' name='nombre' autofocus/>
</div>
<div class='control-group'>
    <p></p>
    <button type='button' class='btn btn-primary' onclick='save()'>Guardar</button>
    <button type='reset' class='btn'>Limpiar</button>
</div>
</form>
<hr/>
<?php 
include_once 'nucleo/tipo_acople.php';
$obj = new tipo_acople();
$objs = $obj->listDB();
?>
<div class='contenedor-tabla'>
    <table id='tb' class='display' cellspacing='0' width='100%'>
        <thead>
            <tr>
                <th>Id</th><th>Nombre</th>
                <th>OPC</th>
            </tr>
        </thead>
        <tbody>
            <?php 
if (is_array($objs)) {
    foreach ($objs as $o) {
        ?>
                    <tr><td><?php