I have the following click event, which when exporting a pdf, is downloaded, but I wanted to place a gif animation loading while it is generated. I've tried to do it like this:
$("#export_pdf").click(function (e) {
e.preventDefault();
$("#ajax_loader").css("display", "");
var formato = "PDF";
var url = "/Obras/Export?format=" + formato + "&nombreObra=" + $('#nombre_obra').val();
window.location.href = url;
$("#ajax_loader").hide();
});
But it is not enough to show the image of the div by loading ajax_loader. I'm exporting a PDF document , using MVC C # and jquery, so I do not use ajax, so I use window.location.href.
I tried to do it, but it does not work for me. If anyone has any ideas, I would appreciate it a lot.