I'm new with Jquery and payed someone to developed a script for me. I notice when I add this script to my website my bandwidth jumps from 1mb's to 5mb's. I have a lot of users on so it leaves me to believe the Jquery part is refreshing to quickly. My question is what do I need to change so it will stop using so much bandwidth in the script below.
Thank you!
<script>
current_time = 1342987067;
start_at = 1342986987;
waiting_time = 120;
break_time = 9999;
view_1 = 'Text removed for example<br>';
view_2 = 'Text removed for example<b><span id="countdown-value"></span></b> seconds.<br>';
view_3 = 'Text removed for example... currently in progress...<br>';
winner = "Text removed for example";
function changeView() {
if (start_at + waiting_time > current_time) {
if (break_time < waiting_time) {
return view_1 + "\n" + winner;
} else {
return view_2 + "\n" + winner;
}
} else {
return view_3 + "\n" + winner;
}
}
function setView() {
$("#countdown-holder")[0].innerHTML = changeView();
}
function reload() {
current_time ++;
break_time = start_at + waiting_time - current_time;
setView();
if (break_time <= waiting_time) {
if ($("#countdown-value")[0] != null)
$("#countdown-value")[0].innerHTML = break_time;
} else {
if ($("#countdown-value")[0] != null)
$("#countdown-value")[0].innerHTML = break_time - waiting_time;
}
setTimeout("reload()", 1000);
}
setTimeout("reload()", 1000);
setView();
</script>
<script>
function setBreakTimeCountdown() {
breakTimeCountdown = parseInt($("#countdown-value")[0].innerHTML);
breakTimeCountdown --;
if (breakTimeCountdown < 0) {
breakTimeCountdown = 0;
reload();
}
$("#countdown-value")[0].innerHTML = breakTimeCountdown;
setTimeout("setBreakTimeCountdown()", 1000);
}
setTimeout("setBreakTimeCountdown()", 1000);
</script>