日期:2014-05-17 浏览次数:20824 次
<script type="text/javascript" src="javascripts/jquery.js" ></script> <script type="text/javascript" src="javascripts/jquery.messager.js" ></script> <script src="javascripts/thickbox2.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> function GetOrderCount() { $.ajax({ type: "get", dataType: "html", url: "getmessages.ashx", data: "", success: function(data){ if (data>0) { $.messager.anim('fade', 2000); $.messager.show('<font color=red>新短消息提醒</font>','您有<font color=red>'+data+'</font>条新短消息未读!') } } }); } $(document).ready(function(){ GetOrderCount() window.setInterval("GetOrderCount()",60000);//1分钟刷新1次 }); </script> //.cs文件 Xywsd xy = new Xywsd(); public int dxiaoxi; public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; string username = context.Session["username"].ToString(); string sqlusers = "select * from users where username='" + username + "'"; DataTable dt = xy.DataALL(sqlusers); //usernames = dt.Rows[0]["truename"].ToString(); //bumen = dt.Rows[0]["user_Depname"].ToString(); string duanxiaoxi = "select xx.xiaoxi_conttents as xiaoxi_conttents,xx.xiaoxi_username as xiaoxi_username,xx.Send_date as Send_date from xiaoxi as xx,xiaoxi2 as x2 where xx.xiaoxi_id=x2.xiaoxiid and x2.jieshouid='" + dt.Rows[0]["user_bianhao"].ToString() + "'and x2.is_read='0'"; dxiaoxi = xy.DataALL(duanxiaoxi).Rows.Count; if (dxiaoxi < 1) { dxiaoxi = 0; context.Response.Write(dxiaoxi); } else { dxiaoxi = xy.DataALL(duanxiaoxi).Rows.Count; context.Response.Write(dxiaoxi); } } public bool IsReusable { get { return false; } }