Show wait animation during mvc redirect action

There is some button that the user clicks to redirect to different controller actions. I would like to show the user some nice pending information (perhaps using a download?) That the user knows to wait. Can you advise something? Below is my curernt code:

this is part of my JS that inserts some href url into the modal bootstrap window:

... var href = $('#details').attr('href'); // currently returns '/TransportGallery/Details/1' href = href.slice(0, href.lastIndexOf('/') + 1) + id; $('#details').attr('href', href); ... 

this is a bootstrap modal window where above js href will be placed and replace this:

 ... <a href="@Url.Action("Details", "TransportGallery", New With {.id = 1})" class="btn btn-primary" id="details"> Show pictures <span class="glyphicon glyphicon-picture" aria-hidden="true"></span> </a> <button type="button" class="btn btn-warning glyphicon glyphicon-off" data-dismiss="modal"> Close</button> </div> </div> </div> </div> ... 

Now that this is done, there is some operation behind which the images are loaded into the gallery, and at that moment I would like to show the user animation. How to do it?

+5
source share
1 answer

You can use BlockUI.JS

 $(function(){ $('#details').on('click',function(){ $.blockUI(); }); }); 

after redirecting the page to another page it will be automatically unlocked.

0
source

Source: https://habr.com/ru/post/1239125/


All Articles