setInterval("UpdateTime()", 60000); function UpdateTime() { var id=$('#hdID').val(); $.ajax({ type: "POST", url: "mypage.aspx/UpdateTime", data: "{'id':'" + id + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { if (msg.d.length > 0) { obj = document.getElementById('feed_TimeStamp' + id); obj.innerHTML = msg.d; //$(obj).slideDown("slow"); } }, async: false, error: function(xhr, status, error) { //alert(xhr.statusText); } }); }
[WebMethod] public static string UpdateTime(string id) { Comments comments = new Comments(); string time = ""; if (comments.LoadByPrimaryKey(Convert.ToInt32(id))) time = MyClass.GetTime(comments.CommentsDate); if (!(time.ToLower().Contains("sec") || time.ToLower().Contains("min"))) time = ""; return time; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)