{"size": 1732, "ext": "js", "max_stars_repo_path": "bitacora_planta/scripts/borrarImagen.js", "max_stars_repo_name": "askr3d/dashboard", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bitacora_planta/scripts/borrarImagen.js", "max_issues_repo_name": "askr3d/dashboard", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bitacora_planta/scripts/borrarImagen.js", "max_forks_repo_name": "askr3d/dashboard", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.0833333333, "max_line_length": 64, "alphanum_fraction": 0.3331408776}
$(document).ready(function(){
    $(document).on("click","#borrarImagen",function(){
        fila = $(this).closest("div");
        id = parseInt(fila.find("input:eq(0)").val());
        nombre = fila.find("input:eq(1)").val();


            var parametros = {
                "id": id,
                "nombre": nombre
            }
            
            $.ajax({
                url: "bitacora_planta/php/borrarImagen.php",
                type: 'post',
                data: parametros,
                success: function(data){
                    if(data==1){
                        eliminarElemento = fila;
                        div = fila.next();
                        if(div.length == 0){
                            div = fila.prev();
                            div.addClass("active");
                        }else{
                            div.addClass("active");
                        }
                        eliminarElemento.removeClass("active");
                        eliminarElemento.remove();
                        $('#myTable').DataTable().ajax.reload();
                        $.toast({
                            heading: 'Imagen eliminada',
                            text: 'Se elimino exitosamente',
                            showHideTransition: 'slide',
                            icon: 'success'
                        });
                    }else{
                        $.toast({
                            heading: 'Error',
                            text: 'Ha ocurrido un error',
                            showHideTransition: 'fade',
                            icon: 'error'
                        });
                    }
                }
            });
    });
});
