I have a C# MVC application that presents the user with a login page. When the user clicks the submit button, I execute a jQuery to show a previously hidden <div>
with a spinning circle and the text that says Please wait while we log you in...
. Then the jQuery submits the form to a controller of my application where the login process starts.
The login process involves accumulating a lot of data across multiple databases so it can take up to 10-15 seconds, depending on the device used to log in.
Is there a way to have the text that is displayed change from Please wait while we log you in...
to something like Sorry for the delay but we are working on it...
after 10 seconds? This way, the text changes so the user doesnt think they are hung up.
Thanks.
2
Answers
You could use
setTimeout()
to update the text after 10 seconds :Using a
setInterval
we can produce somethingYou can change time from 1s to 10s