如何在页面上获取新内容,而无需刷新页面

时间:2011-08-18 17:53:24

标签: javascript ajax refresh

如果您查看Foursquares网页:https://foursquare.com/

他们在不刷新页面的情况下自动进入新的Feed。我正在建立一个后端,我们可以看看用户的speciefic feed。我怎么能得到Foursquare使用的相同效果?

2 个答案:

答案 0 :(得分:1)

这是setInterval和他们的ajax调用的混合。

setInterval(1000, function() {
    // Make ajax call here to get more information and append new elements to the DOM.
});

答案 1 :(得分:1)

以下是对AJAX的一个很好的介绍:

http://www.w3schools.com/ajax/default.asp