<?php
include ('../include/cache.php'); 
include "../conexion.php";

$cotd_id=$_GET['id']; 

?>
<div class="modal-body" style="padding-left:10px;">
    <div id="resultados_mod"></div> 
    <form role="form" id="editar" >      
        <div class="col-md-12">
        <?php
           $can1=mysqli_query($con,"SELECT * from dis_cotizacion_detalle where cotd_id='$cotd_id'") or die(mysqli_error($con)); 
           while ($row1=mysqli_fetch_array($can1)){ 

            $cotd_id =$row1['cotd_id'];
            $cotd_art_id=$row1['cotd_art_id'];

            ?>
            <input type="hidden" name="cotd_id" value="<?php echo $cotd_id ?>">
            <input type="hidden" name="cotd_art_id" value="<?php echo $cotd_art_id ?>">
            <input class="form-control" title="Editar" type="text" name="cotd_nombre" id="cotd_nombre" value="<?php echo $row1['cotd_nombre']; ?>" >
             <?php } ?>
            
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
            <button type="submit" id="modi" class="btn btn-primary">Modificar</button>
        </div>
    </form>
    </div>  
</div>
<script>
$( "#editar" ).submit(function( event ) {
$('#modi').attr("disabled", true);
var parametros = $(this).serialize();
$.ajax({
    type: "POST",
    url: "php_cotizacion/z_editar_descripcion.php",
    data: parametros,
        beforeSend: function(objeto){
        $('#resultados_sab').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
    success: function(datos){
    $("#resultados_mod").html(datos);
    $('#modi').attr("disabled", false);
    $('#descripcion_art_Modal').modal('hide');
    $('body').removeClass('modal-open');
    $('.modal-backdrop').remove();
    loadTabla();
    }
});
event.preventDefault();
})
</script>