zoukankan      html  css  js  c++  java
  • 使用ajax调用WebService函数

            string js;
            js = "";
            js += "function CallWebServices(){";
            js += "AutoComplete.GetLoginUserCount(onOK);";
            js += "}";
            js += "function onOK(returnData){";
            js += "$get('TextBox1').value=returnData;";
            js += "}";
            js = "<script>" + js + "</script>";
            ClientScript.RegisterStartupScript(typeof(string), "", js);
            Button1.Attributes.Add("onclick", "CallWebServices();");
            ScriptManager1.Services.Add(new System.Web.UI.ServiceReference("AutoComplete.asmx"));
     

        [WebMethod]
        public string GetLoginUserCount()
        {
            string UserCount="0";
            UserCount =  Convert.ToString(SqlHelper.ExecuteScalar(ConfigurationSettings.AppSettings["connString"], "GetUsersLoginedCount")).Trim();//已登陆用户总数
            return UserCount;
        }
  • 相关阅读:
    【Scrum】2.18
    【scrum】2.22
    绿色软件 Vs 安装软件
    【Scrum】2.21
    【scrum】2.15
    读《design pattern》有感
    让广告再播一会儿~
    Qt::日志处理
    终于在博客园开通了
    惹毛程序员的十件事
  • 原文地址:https://www.cnblogs.com/hhq80/p/1108127.html
Copyright © 2011-2022 走看看