zoukankan      html  css  js  c++  java
  • 右下角弹出框实现

    通过Ajax方式实现(Jquery+ashx)

    通过Jquery的$.post连接ashx取得相应数据,拼接成string字符串返回,然后用JquerUI插件显示(本文简化了,用Alert代替)。

    aspx代码如下:

    //此代码应放置在框架页中

    function TimeFunction() {
                GetMsg();
                window.setInterval("GetMsg()", 240000); //每隔240000ms执行一次查询
            }

    function GetMsg() {

                var userId = $("#<%=hfUId.ClientID %>").val();

               //ajax方式获取数据
                $.post("GetMsgHandler.ashx", { Action: "getMsg", userid: userId }, function (data) {
                    if (data != "") {
                       alert(data);

    // 用JqueryUI控件的写法:

    //$.messager.show('<font color=red>系统消息</font>', '<div style="word-wrap: break-word; ">' + data + '</div>', 20000);
                    }

                });
            }

    TimeFunction() ;

    ashx 代码如下:

    public void ProcessRequest(HttpContext context)
          {

              context.Response.ContentType = "text/plain";       
              string resMsg1 = "";
              GetMsg(context, out resMsg1);//此方法用于去数据库查询数据,然后返回结果                  
              context.Response.Write(resMsg1);

            }

  • 相关阅读:
    PyCharm常用快捷键
    在PyCharm中打开文件的位置
    使用Socket下载图片
    Python散列类型和运算符
    Python格式化输出和深浅复制
    爬虫的概念和会话
    Python数值类型和序列类型
    HTTP与HTTPS
    PyCharm彻底删除项目
    PyCharm永久激活
  • 原文地址:https://www.cnblogs.com/guxingwork/p/2944603.html
Copyright © 2011-2022 走看看