Hobbyist_PHPer Posted May 16, 2012 Share Posted May 16, 2012 Hi, I have a JQuery script that I am using part of, partially, and I could use some help with it... Right now it counts down and displays in seconds, I am hoping someone can show me how to make it display in minutes and seconds... Then the next function in it is a submit form function... that's the part that I'm not currently using, but need to for the next step... So, here's what I have... if ($row['CallTaken'] == "No") { ?> <script> $(function() { var seconds = 600; setTimeout(updateCountdown, 1000); function updateCountdown() { seconds--; if (seconds > 0) { $("#countdown").text("You have " + seconds + " seconds remaining"); setTimeout(updateCountdown, 1000); } else { submitForm(); } } }); // Here the operator has not answered the call within 10 minutes, need to take action... function submitForm() { document.forms[0].submit(); } </script> <? } else { ?> <script> $(function() { $("#countdown").text("You have accepted the call."); }); </script> <? } The submit form section, I would like to know if that would allow me to put a hidden form in the page, name or id it, and then have that function submit it? Quote Link to comment https://forums.phpfreaks.com/topic/262643-help-with-countdown-function/ Share on other sites More sharing options...
rythemton Posted May 16, 2012 Share Posted May 16, 2012 minutes = math.floor( seconds/60 ); countseconds = seconds % 60; text = "You have " + minutes + ":" + ( countseconds < 10 ? "0" : "" ) + countseconds + " remaining. Quote Link to comment https://forums.phpfreaks.com/topic/262643-help-with-countdown-function/#findComment-1346156 Share on other sites More sharing options...
Hobbyist_PHPer Posted May 17, 2012 Author Share Posted May 17, 2012 minutes = math.floor( seconds/60 ); countseconds = seconds % 60; text = "You have " + minutes + ":" + ( countseconds < 10 ? "0" : "" ) + countseconds + " remaining. I appreciate your response, and it would seem that your code should work, but so much as even adding the minutes variable anywhere, breaks the function. Quote Link to comment https://forums.phpfreaks.com/topic/262643-help-with-countdown-function/#findComment-1346170 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.