为什么在SetInterval上重新加载页面

时间:2013-12-10 08:05:14

标签: javascript

    setInterval(UpdateGroupMessages, 10000,false);
function UpdateGroupMessages() {
    $.ajax({
                        type: "POST",
                        async: false,
                        url: "GroupNew.aspx/UpdateGroupMessages",
                        data: "{'groupId' : " + groups[m].GroupId + ", 'name' : " + JSON.stringify(groups[m].GroupName) + ",'count' : " + JSON.stringify(count) + "}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            var i = 0;
                            n = m + 2;
                            while (i < data.d.length) {
                                var str1 = "#tabs-" + n;
                                var str2 = " .messagesContainer";
                                var str = str1 + str2;
                                if (data.d[i].Image == "") {                                
                                    var UsernameAndMessage = BreakUsernameAndMessage(data.d[i].Message);
                                    ViewModel.addMessage(n, UsernameAndMessage[0], UsernameAndMessage[1], null, data.d[i].Video, data.d[i].PostedTime);
                                }
                                else {
                                    var UsernameAndMessage = BreakUsernameAndMessage(data.d[i].Message);
                                    ViewModel.addMessage(n, UsernameAndMessage[0], UsernameAndMessage[1], "ShareImages/" + data.d[i].Image, data.d[i].Video, data.d[i].PostedTime);                                
                                }
                                i++;
                            }
                        },
                        error: function (jqXHR, textStatus, errorThrown) { }
                    });
                    m++;
                    k++;
                }
}

我的页面在数据更新后重新加载。为什么页面会重新加载?

1 个答案:

答案 0 :(得分:0)

经过一些调试后我找到了答案。