Javascript 如何发送复选框的值?

Javascript 如何发送复选框的值?,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我有一个用jquery.tabledit.js库创建的表,我是新来的,在表中我显示了一个复选框,下面是代码 <?php require ('recursos/conexion.php'); $page = isset($_GET['p'])? $_GET['p'] : '' ; if ($page=='view') { $sql = "exec sp_sys_nom_autoriza2 'A30',1"; $stmt = sqls

我有一个用jquery.tabledit.js库创建的表,我是新来的,在表中我显示了一个复选框,下面是代码

<?php
    require ('recursos/conexion.php');



    $page = isset($_GET['p'])? $_GET['p'] : ''
;   if ($page=='view') {

        $sql = "exec sp_sys_nom_autoriza2 'A30',1";
        $stmt = sqlsrv_query($conexion, $sql);
      $select =  "select * from sysnom_nomina_det_tmp where suc = 'A30'";
      $stm = sqlsrv_query($conexion, $select);
        $totalVU = sqlsrv_num_rows($stm);     
       while($row = sqlsrv_fetch_array($stm, SQLSRV_FETCH_ASSOC)) {

         if ($row['notas'] !== "AHORRO" ) {
              if ($row['notas'] !== "PRESTAMO DE AHORRO") {
         ?>
        <tr  style="width:1900px" >

          <td style="width:80px;"><?php echo $row["ID"]?>     </td>
          <td style="width:100px;"><?php echo $row["suc"]?>     </td>
          <td style="width:141px;"><?php echo $row["nombre"]?>  </td>
          <td style="width:141px;"><?php echo $row["depto"]?>   </td>
          <td style="width:141px;"><?php echo $row["percepcion"]?></td>
          <td style="width:141px;"><?php echo number_format($row["monto"], 2, '.', '')?></td>
          <td style="width:141px;"><?php echo $row["notas"]?>   </td>
<?php
          $autorizar = rtrim($row['autorizar']);
           if ($autorizar == 1) {
                         echo "<td id='autorizar'><input type ='checkbox' name='checkbox' id='checkbox' value='1' style='width:30px; height:30px;' checked></td>";
                         $aut=1;
                      }else{
                         echo "<td id='autorizar'><input type ='checkbox' name='checkbox' id='checkbox' value='0' style='width:30px; height:30px;'></td>";
                         $aut=0;
                      }

    }  
  }
}
}else{

  header('Content-Type: application/json');
    $input = filter_input_array(INPUT_POST);

    if ($input['action'] === 'edit') {
            $actualizar ="UPDATE sysnom_nomina_det_tmp SET monto='".$input['Monto']."', autorizar='' where ID='".$input['ID']."' AND suc = '".$input['Sucursal']."' ";
            $resul = sqlsrv_query($conexion, $actualizar);
              if(!$resul){
                echo "Error al Actualizar";
              } else {
                 echo "Datos Actualizados";
              }

        }
    echo json_encode($input);
  sqlsrv_close($resul);
}
?>

你能试试这个吗好的非常感谢我会试试看它对我是否有效我不知道如何应用它把我弄糊涂了我不知道你是否能帮我把它应用到我的代码中请在任何你想访问函数tableData()中复选框值的地方使用这个函数如果($('#checkbox').is(“:checked”){$('#checkbox').val()}你能试试这个吗好的非常感谢我会试试看它对我是否有效不知道如何应用它把我弄糊涂了我不知道你是否能帮我把它应用到我的代码中请在任何你想访问函数tableData()中复选框值的地方使用这个函数如果($('.'复选框').is(“:checked”){$('.'复选框').val()}
 <div class = "contenedor" style="width: 1120px; ">
      <table id="tabledit" class="table ">
          <thead>
              <tr style= "width:1400px;">

                  <th style= "width:80px;">N°</th>
                  <th style= "width:100px;">Sucursal</th>
                  <th style= "width:141px;">Nombre</th>
                  <th style= "width:141px;">Departamento</th>
                  <th style= "width:141px;">Percepcion</th>
                  <th style= "width:141px;">Monto</th>
                  <th style= "width:141px;">Notas</th>
                  <th style= "width:141px;">Autorizar</th>  
              </tr>
          </thead>
          <tbody>

          </tbody>
      </table>  
    </div>
  </div>
</form>

  <script src="../js/hola.js"></script>
  <script src="../js/bootstrap.js"></script>
  <script src="../js/jquery.tabledit.js"></script>
  <script src="../js/buscar.js"></script>

  <script>

  function viewData(){
    $.ajax({
      url: '../A30.php?p=view',
      method: 'GET'
    }).done(function(data){
      $('tbody').html(data)
      tableData()
    })
  }
  function tableData(){
    $('#tabledit').Tabledit({
      url:'../A30.php',
      eventType: 'dblclick',
      editButton : true, 
      deleteButton : false,

       columns:{
              identifier:[[0,'ID'],[1, 'Sucursal']],
              editable: [[5,'Monto']]

      },
      buttons:{
      style: 'width:150px;',
        edit:{
          class: 'btn btn-sm btn-success' ,
          html: '<span class="fa fa-pencil-square-o" ></span> Editar',
          action: 'edit'
        },
        delete:{
          class: 'btn btn-sm btn-default',
          html: '<span class="glyphicon glyphicon-trash"></span> Trash',
          action: 'delete'
        },
        save:{
          class: 'btn btn-sm btn-info',
          html: '<span class="fa fa-floppy-o  "></span> Guardar'
        },
        restore:{
          class: 'btn btn-sm btn-warning',
          html: 'Restore',
          action: 'restore'
        },
        confirm:{
          class: 'btn btn-sm btn-danger',
          html: 'Confirm'
        },
      },
      onSuccess: function(data, textStatus, jqXHR){
        viewData()
      },
      onFail: function(jqXHR, textStatus, errorThrow){
        console.log('onFail(jqXHR, textStatus, errorThrow)');
        console.log(jqXHR);
        console.log(textStatus);
        console.log(errorThrow);
      },
      onAjax: function(action, serialize){
        console.log ('onAjax(action, serialize)');
        console.log(action);
        console.log(serialize);
      }
    });
  }

  </script>
</body>
</html>