加载json对象的setinterval一个接一个

时间:2016-06-02 05:58:30

标签: javascript jquery json

我有一个带有对象的数组,我必须以相等的时间间隔逐个显示它,代码完全显示json我需要逐个添加每个注释。

<script>
        $(document).ready(function() {

            $('div.comment-container').comment({
                title: 'Comments',
                url_get: 'articles/id/1/comments/list',
                limit: 10,
                auto_refresh: false,
                refresh: 10000,
                transition: 'slideToggle',
            });


        }); 
</script>

我的数组有

{
    "results": {
        "comments": [
            {
                "comment_id": "1",
                "parent_id": "0",
                "in_reply_to": null,
                "element_id": "134",
                "created_by": "1",
                "fullname": "Administrator admin",
                "picture": "../css/images/user_blank_picture.png",
                "posted_date": "2013-02-27 09:03:25",
                "text": "Test message one",
                "attachments": [],
                "childrens": [
                    {
                        "comment_id": "3",
                        "parent_id": "1",
                        "in_reply_to": "Administrator admin",
                        "element_id": "134",
                        "created_by": "2",
                        "fullname": "Manager manager",
                        "picture": "../css/images/user_blank_picture.png",
                        "posted_date": "2013-02-27 08:48:50",
                        "text": "Hi, reply for you",
                        "attachments": [],
                        "childrens": []
                    },
                    {
                        "comment_id": "2",
                        "parent_id": "1",
                        "in_reply_to": "Administrator admin",
                        "element_id": "134",
                        "created_by": "1",
                        "fullname": "Administrator admin",
                        "picture": "../css/images/user_blank_picture.png",
                        "posted_date": "2013-02-26 11:30:44",
                        "text": "Test message level 2",
                        "attachments": [],
                        "childrens": [
                            {
                                "comment_id": "4",
                                "parent_id": "2",
                                "in_reply_to": "Administrator admin",
                                "element_id": "134",
                                "created_by": "2",
                                "fullname": "Manager manager",
                                "picture": "../css/images/user_blank_picture.png",
                                "posted_date": "2013-02-27 08:50:05",
                                "text": "replied as level 3",
                                "attachments": [],
                                "childrens": []
                            }
                        ]
                    }
                ]
            }
        ],
        "total_comment": 4,
        "user": {
            "user_id": 1,
            "fullname": "Administrator admin",
            "picture": "../css/images/user_blank_picture.png",
            "is_logged_in": true,
            "is_add_allowed": true,
            "is_edit_allowed": true
        }
    }
}

我需要的是每个评论都应该以相等的间隔逐一添加到浏览器中

0 个答案:

没有答案