<?php
session_start();
require_once('../conexion.php');
require_once('../include/sesiones.php');
?>
<script type="text/javascript">
$(setup)
function setup() {
    $('#intro select').zelect({ placeholder:'' })
}
</script>
<div id="datoscxp"></div>
<div id="ventanacxp">
    <form method="post" action="" id="form_buscarcxp" name="form_buscarcxp">
        <input type="hidden" name="factura" value="" class="form-control name_list" autocomplete="off"  >
        <div class="form-group">
            <label class="pull-left">Documento o Nombre</label>
            <section id="intro" >
                <select name="proveedor" id="proveedor" class="form-control name_list" >
                    <option value=""> - </option>
                    <?php
                        $datos2=mysqli_query($con,"SELECT * FROM proveedor WHERE empresa='$empresa'");
                        while($fila2=mysqli_fetch_array($datos2))
                        {
                            echo' <option value="'.$fila2['pro_id'].'">'.$fila2['pro_nombre'].'</option>';

                        }
                    ?>
                </select>
            </section>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
            <button type="submit" class="btn btn-success" name="btn_buscarcxp" value="btn_buscarcxp" id="btn_buscarcxp">Buscar</button>
        </div>
    </form>
</div>
<script>
$("#form_buscarcxp").submit(function( event ) {
$('#btn_buscarcxp').attr("disabled", true);
var parametros=$(this).serialize();
    $.ajax({
    type: "POST",
    url: "php_movimientos/forms_cxp.php",
    data: parametros,
    beforeSend: function(objeto){
     $('#datoscxp').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
    },
    success: function(datos){
    $("#datoscxp").html(datos);
    $('#btn_buscarcxp').attr("disabled", false);
    document.getElementById("form_buscarcxc").reset();
    }
    });
    event.preventDefault();
})
</script>