Solved

Ajax loading div with decrementing counter

Posted on 2011-03-04
7
405 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
[X]
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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CRM 2011 Setting Lookup Defaults 6 178
simple ajax form sumbit 9 72
jQuery AJAX Redirects Without Response/Error 10 76
Ajax and PHP 9 53
jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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