Click here to Skip to main content
14,976,755 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

I am requesting one url using xmlHttpRequest in javascript. And i want to show one loader or progress bar until request not getting response for url.

Now, i achieve that things using Asynchronously but i want to show loader using synchronous method and when i used synchronous way the browser not able to seen any loader or progress bar.

Could you please let me know what i do so that i can achieve that.

Thanks.
Posted
Updated 11-Nov-11 0:29am
v2
Comments
Slacker007 11-Nov-11 6:30am
   
Edit: readability

1 solution

This will never work. If your method showing the progress would remain in a function call (in a loop I'd presume) there would be no visible updates to the GUI frontend and your application would seem to be frozen. The display of your progressbar or loader indicator will also have to work asynchronously. I suggest you use a timer to make the changes to your progressbar / loader until the indication was received that the URL has been fully loaded.

Cheers!

—MRB
   
Comments
Little-Coder 11-Nov-11 7:13am
   
Yes, you are right but as you said use a timer then i used settimeout() function for achieve synchronous but it also not work. Could i used any another for that.?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900