Your Html.ActionLink()
will generate a html
similar to this:
<a href="/DeliveryService/Import">Importar</a>
Once you've done this, you just have to intercept the requests and display the GIF.
Below is a simple example of how to do this:
$('a').click(function(){
$('#loadingFull').fadeIn();
});
Note that since the page will be updated, it does not require $('#loadingFull').fadeOut();
.
See a simple example below:
$('a').click(function() {
$('#loadingFull').fadeIn();
});
div#loadingFull {
position: fixed;
left: 0;
top: 0;
z-index: 999;
width: 100%;
height: 100%;
overflow: visible;
background: #333 url('http://files.mimoymima.com/images/loading.gif') no-repeat center center;
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="loadingFull"></div>
<a href="#">Importar</a>
For submit()
you can do something similar, but instead of .click()
, you can use .submit () .
Apparently you're using Asp.NET MVC
. With this, you can add the code in your _Layout.cshtml
file that will serve all pages.
The loader example I removed from here.