Skip to content

Instantly share code, notes, and snippets.

@sudoyu
Last active December 14, 2015 12:39
Show Gist options
  • Save sudoyu/5087658 to your computer and use it in GitHub Desktop.
Save sudoyu/5087658 to your computer and use it in GitHub Desktop.
JustGage http://www.justgage.com/ を使って定期的に .refresh() するメモ。
// JustGageの対象要素に対して描画
var g = new JustGage({
id: "gauge",
value: 0,
min: 0,
max: 10,
title: "counter"
});
// ajaxリクエストでrefresh()する関数
function getGauge() {
$.ajax({
url : "/count/get/",
dataType : "text",
success : function(data){
g.refresh(data);
}
});
};
// jQuery で定期的に実行
$(function() {
var timer = setInterval( function () {
getGauge();
} , 1000 );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment