jquery - can't see where I am missing ; before statement -
iam trying create timer using javascript function timer , mysqli bound variable $dbsessionduration
retrieve start time db. issue that:
missing ; before statement
cannot see problem pointing on same line variable itself how can prepare error?
view source code below: (function(){ $(document).ready(function() { var time = notice: undefined variable: dbsessiondurationtime in /web/stud/u0867587/mobile_app/assessment.php on line 108 null, parts = time.split(':'), hours = +parts[0], minutes = +parts[1], seconds = +parts[2], span = $('#countdown'); function correctnum(num) { homecoming (num<10)? ("0"+num):num; } var timer = setinterval(function(){ seconds--; if(seconds == -1) { seconds = 59; minutes--; if(minutes == -1) { minutes = 59; hours--; if(hours==-1) { alert("timer finished"); clearinterval(timer); return; } } } span.text(correctnum(hours) + ":" + correctnum(minutes) + ":" + correctnum(seconds)); }, 1000); }); });
actual code below:
(function(){ $(document).ready(function() { var time = <?php echo json_encode($dbsessiondurationtime); ?>, parts = time.split(':'), hours = +parts[0], minutes = +parts[1], seconds = +parts[2], span = $('#countdown'); function correctnum(num) { homecoming (num<10)? ("0"+num):num; } var timer = setinterval(function(){ seconds--; if(seconds == -1) { seconds = 59; minutes--; if(minutes == -1) { minutes = 59; hours--; if(hours==-1) { alert("timer finished"); clearinterval(timer); return; } } } span.text(correctnum(hours) + ":" + correctnum(minutes) + ":" + correctnum(seconds)); }, 1000); }); });
$dbsessiondurationtime
isn't defined. if go , define should no longer receive error. php , not java script.
jquery
No comments:
Post a Comment