Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-31-2012, 06:22 PM   PM User | #1
Vernier
New Coder

 
Join Date: Dec 2011
Posts: 86
Thanks: 1
Thanked 0 Times in 0 Posts
Vernier is an unknown quantity at this point
Loading image?

Hey,

I need it so that when the content of my page is loading, a loading image is shown. If content is in the container, that all clears and the loading image shows until it has loaded or for X seconds?

Thanks

~ David
Vernier is offline   Reply With Quote
Old 04-01-2012, 12:06 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Do you mean the initial page load or do you mean dynamic/asynchronous loading via Ajax?
devnull69 is offline   Reply With Quote
Old 04-01-2012, 02:27 AM   PM User | #3
Mishu
Banned

 
Join Date: Mar 2012
Posts: 306
Thanks: 1
Thanked 28 Times in 28 Posts
Mishu can only hope to improve
Thius is an ajax forum so I assume you mean with ajax.

When the ajax function is called, delete any content using DOM methods and then display a loading image. In your ajax object's onreadystatechange handler, when the readystate = 4 and the status = 200, hide the loading image and display the new content.
Mishu is offline   Reply With Quote
Old 04-01-2012, 01:06 PM   PM User | #4
Vernier
New Coder

 
Join Date: Dec 2011
Posts: 86
Thanks: 1
Thanked 0 Times in 0 Posts
Vernier is an unknown quantity at this point
Quote:
Originally Posted by devnull69 View Post
Do you mean the initial page load or do you mean dynamic/asynchronous loading via Ajax?
Quote:
Originally Posted by Mishu View Post
Thius is an ajax forum so I assume you mean with ajax.

When the ajax function is called, delete any content using DOM methods and then display a loading image. In your ajax object's onreadystatechange handler, when the readystate = 4 and the status = 200, hide the loading image and display the new content.
I'm using Hash tag ajax, so when site.com/#!/example is visited, example is loaded. I need this to load an image.

Thanks

~ David
Vernier is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:58 PM.


Advertisement
Log in to turn off these ads.