Solved

Ajax loading div with decrementing counter

Posted on 2011-03-04
7
376 Views
Last Modified: 2012-05-11
Hi,
I have already set up a loading div and I pass php based time to it.
what I looking for is a nice loading div with the decrementing counter - I can pass the counter/time to it

It would be great if some one could help me out with it.

Thanks,
Sameer.
0
Comment
Question by:SameerMirza
  • 4
  • 3
7 Comments
 
LVL 8

Expert Comment

by:McNetic
ID: 35081616
If you can provide a working code sample of what you already have, I'll try to help you find a solution. I don't exactly understand what you have, and what you want to get.
0
 

Author Comment

by:SameerMirza
ID: 35082880
its just be java script, AJAX and CSS I belive or may be only CSS.
I am sure you are aware of timer functions in javascript
lets say I have 60 secnods
All I want to show is display the counter 60, 59, 58....seconds remaining
Although I have changed my design but it would be goog to find a solution
I hope you understand what I want achieve
0
 
LVL 8

Accepted Solution

by:
McNetic earned 500 total points
ID: 35083079
That could be as simple as this:

<div id="counter">Counter
</div>
<script type="text/javascript">
function countdown(start) {
	if ('undefined' == typeof(start)) {
		start = parseInt(document.getElementById('counter').firstChild.data) - 1;
	}
	document.getElementById('counter').firstChild.data = start;
	if (0 < start) {
		setTimeout(countdown, 1000);
	}
}
countdown(60);
</script>

Open in new window

0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:SameerMirza
ID: 35083859
thanks for your help. It would be done like this but I am not exactly what I am looking for.
for example we say setTimeout(countdown, 60000);
I am looking for a counter to be display as 60 - 59 - 58 untlil it reaches 0
mean 60 sec to 0 secs waiting div.
0
 
LVL 8

Expert Comment

by:McNetic
ID: 35086856
Uhm, I'm afraid we've got a little misunderstanding. What do you mean by waiting div? Did you try my code? It does display a div, starting with 60, counting down to 0, decrementing by 1 every second.
0
 

Author Comment

by:SameerMirza
ID: 35093333
hey it man :) my bad
0
 

Author Closing Comment

by:SameerMirza
ID: 35093336
it works :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today I am discussing AJAX problems in IE7 and I bet this will helps many guys out here who have problems with AJAX work. Lets start with the discovery of problem and then we will talk about its different solutions. My last two projects included …
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now