I have an action that returns a file
return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName);
I managed to show the loader on form submit, using javascript
This is my view:
<form method="post" asp-action="Action" asp-controller="Controller" Area="Area" enctype="multipart/form-data">
<div class="panel-container show">
<input type="submit" id="btnUpload" class="col-md-4" />
</div>
<div class="spinner-border mx-2" id="loader" role="status">
<span class="sr-only">Loading...</span>
</div>
</form>
This is the code I added in the JS to make the loading animation start, and it works:
$('#loader').hide();
$(function() {
$('form').submit(function(){
$('#loader').show();
});
});
Now how do I hide it when the action is done doing its deed? Is there any way to do it without using AJAX?