var number = -1; var waiting = function(){ var path = '/test'; path += '/' + number; $.ajax({ url: path, type: 'REFRESH', dataType: "json" }) .done(function(data){ $("#idNumberArea").html(data); number = data; waiting(); }) .fail(function(){ //alert("Server lost"); //tritt bei Reload der Seite einmal auf, danach alles OK //Wayne, deswegen auskommentiert }); }; inc = function(){ $.ajax({ url: '/test', type: 'INC' }) }; $(document).ready(function(){ waiting(); }); var clock_id = 'clock'; var clock_size = 100; var clock_color = 'rgb(0, 0, 0)'; setInterval(drawClock, 250); /** * Initializes the clock canvas. * * @param id * The ID of the clock canvas element * @param size * The size of the clock (size == width == height) * @param color * The color of the clock in 'rgb(r, g, b)' format */ function initClock(id, size, color) { clock_id = id; clock_size = size; clock_color = color; } /** * Draws the clock. */ function drawClock() { var canvas = document.getElementById(clock_id); var ctx = canvas.getContext('2d'); canvas.width = clock_size; canvas.height = clock_size; ctx.translate(clock_size / 2, clock_size / 2); ctx.fillStyle = clock_color; ctx.save(); for ( var i = 1; i