Ali Foroughi
Ali Foroughi

Reputation: 4609

run a script before page start to redirect

Is there any way to show a loading element when user click on a link or any thing that cause page start to reload , until browser start to show server response?

Upvotes: 0

Views: 320

Answers (1)

Massimiliano Peluso
Massimiliano Peluso

Reputation: 26737

you have to write a JavaScript function that shows the element that contains your loading mock up when you click let's say a button.

The page render will override that as soon as the server response back.

if you are familiar with JQuery and Ajax the best way would be to use an asyn post.

  • Use Jquery to show the loading mock up
  • Async post to the server
  • Use Jquery to get the response,hide the loading mock up, refresh the portion of the page you need to

Upvotes: 1

Related Questions