开发者

Real time countdown timer that gets updated by user action. Connected to the database. Implementation?

How wou开发者_StackOverflowld i implement such a timer?

Please take a moment to have a look at this countdown timer. http://bigdeal.com (see one of the products)

What would you do with the db. How would you intergrate with javascript?

Thank you


First, you have to use an AJAX request to get all the new values.

Then you can repeat this AJAX request using setInterval()

var updateCountdowns = function(){
    $.ajax({
        url: 'get_countdowns.php',
        cache: false,
        dataType: 'json',
        success: function(data) {
             // update your countdowns
        }
    });
};

setInterval(updateCountdowns, 1000); // Repeated every 1000 ms (1 sec)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜