[RESOLVED]Jquery Countup error

Hi,

I am using http://keith-wood.name/countdown.html. This is working fine on local server but on staging it is not working according to my expectation. On click of submit countup timer not starting and when I
refresh page then start working. Second behavior, if I used Window.SetInterval for 2 seconds then It works. Below is the code:

HTML Code:

<div id="divCountdown" style="width130px;"> <input type="hidden" 
class
="HelpDeskTicketTimeStamp" value='@Model.RequestTimeStamp.ToString("dddd, dd MMMM yyyy HH:mm:ss")' />
 </div>

 Jquery Code:

<script type="text/javascript">     $(function () {       
  try {          
  var requestTimeStampDate = new Date($('.HelpDeskTicketTimeStamp').val());           
 $('#divCountdown').countdown({ since: requestTimeStampDate, timezone: '' });      
  } catch (e) {         }     });
</
script>

If I write above code in 2 sec interval then it works. I want to know what is this doing in
2 sec interval or please help me to implement this to implement perfectly.

Thanks

Nothing looks wrong with the code.

Are you getting any exceptions in your try/catch?

Have you tried using the page onload instead of jquery’s to see if that makes a difference?

Do you have the countdown function include statement below your jquery include? If it’s above, this could happen but you are more likely to get an error.

Just a few simple ideas to try, hope 1 works for you.

Leave a Reply