Gif to load while website loads!

Asked

Viewed 951 times

5

I am developing a website (MVC), where there is a user option to select an Excel file, and all table data is sent to the database and only then appears a warning of success or failure when recording the data.

This task takes a certain time and during this time the site keeps loading. This may lead the user to think that the site has crashed, so during this time I thought about putting a gif to load and when the warning of success or failure appears the gif would disappear.

How do I do that? I found a few things on the internet like putting them on a div and using the Hide and show functions but nothing like the expected effect.

I also thought instead of showing the warning it be redirected to another screen when finished, thinking that it would be easier to print this effect, but again without success. I would like some suggestion so that I could finish this technical work successfully.

  • take a look at this Loading , I use in some applications and works well.

1 answer

2


HTML

 <img id="loading" src="../../Content/progress.gif" alt="Updating ..." style="display: none;" />

Jquery

<script type="text/javascript">
    $(document).ready(function() {

            $('#loading').hide();

            $('#btnPostarExcel').click(
                function() {

                    $('#loading').show();

                }
            );
        }
    );
</script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.