頁面使用AJAX

 var time;
        window.onload = Monitor = function() {
            try {
                var dte = new Date();
                var url = "AppGroup.ashx";
                $.ajax({
                    url: url,
                    data: { dte: dte },
                    method: 'GET',
                    dataType: 'html',
                    success: function(data) {
                        $("#lastime").html("最後一次更新時間:" + dte.toLocaleString());
                        if (data) {
                            $("#div_app").html(data);
                        }
                    }
                });
                if (time != null) {
                    clearTimeout(time);
                }
                time = setTimeout('Monitor()', 60000); //60 sec
            }
            catch (ex) {
                alert(ex.message);
            }
        }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章