Upload Gif while site loads!

5

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

This task takes some time and during this time the site is loading. This could lead the user to think that the site crashed, so during this time I thought about putting a loading gif and when the warning of success or failure appeared the gif would disappear.

How do I do this? I found some things on the internet like putting them in a div and using the hide and show functions, but nothing like the expected effect.

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

    
asked by anonymous 05.06.2017 / 17:48

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>
    
05.06.2017 / 20:25