<form method="post" name="modif_familia" id="modif_familia" enctype="multipart/form-data">
<div class="modal fade" id="modificar_familia" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Modificar Categoria</h4>
            </div>
            <div class="modal-body">
                <div class="form-group ">
                    <label for="nombres" class="col-sm-4 control-label">Nombre</label>
                    <input type="hidden" class="form-control" id="id" name="id" required >
                    <input type="text" class="form-control" id="nombre" name="nombre"  required>
                </div>

                <label>&nbsp</label>
                    <label for="imagen_cate" style="width: 100%;">Cambiar Imagen </label>
                    <input type="file"  name="imagen_cate" id="imagen_cate" >

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
                    <button type="submit" id="submit" class="btn btn-success">Modificar</button>
                </div>
            </div>
        </div>
    </div>
</div>
</form>
<script >

$( "#modif_familia" ).submit(function( event ) 
{
    $('#submit').attr("disabled", true);
    var formData = new FormData($("#modif_familia")[0]);
    var ruta = "php_familias/editar_familia.php";
    $.ajax({
        type: "POST",
        url: ruta,
        data: formData,
        contentType: false,
        processData: false, 
        beforeSend: function(objeto){
            $('#resultados_fam').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
        success: function(datos){
        $("#resultados_fam").html(datos);
        $('#submit').attr("disabled", false);
        $('#modificar_familia').modal('hide');
        $('body').removeClass('modal-open');
        load(1);
    }
});
event.preventDefault();
})

</script>
