버튼을 클릭 할 때마다 새로 고침을 받아 임의의 데이터를 가져 오는 게이지가 있습니다.자바 스크립트를 사용하여 div 자동 새로 고침
나의 질문은 버튼을 클릭하지 않고 어떻게 할 수 있는가? 매 5 초마다 자동 새로 고침을 원한다.
<div id="gg1" class="gauge">
</div>
<a href="#" id="gg1_refresh" class="button grey">Random Refresh</a>
<script>
var gg1 = new JustGage({
id: "gg1",
donut: 1,
title: "BARTOW",
titleFontColor: "#000000",
value: 95.7,
min: 0,
max: 100,
labelFontColor: "#000000",
humanFriendlyDecimal: 1,
decimals: 1,
symbol: "%",
refreshAnimationType: "bounce",
gaugeWidthScale: 0.6,
customSectors: [{
color: "#ff0000",
lo: 0,
hi: 79
}, {
color: "#ffa500",
lo: 80,
hi: 89
}, {
color: "#1eae1e",
lo: 90,
hi: 100
}],
counter: true
});
$(document).ready(function() {
$('#gg1_refresh').bind('click', function() {
gg1.refresh(getRandomInt(0, 100));
return false;
});
});
</script>
OP가 setInterval을 요청하면이 링크 (http://www.quackit.com/javascript/javascript_refresh_page.cfm – Rubyist