Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Ajax loading div with decrementing counter

Posted on 2011-03-04
7
401 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

829 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