运行的时候,浏览器它提示WebService未定义,WebService为定义好的web服务类.页面前端代码为: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <input id="Button1" type="button" value="button" onclick="callWebService()" />后端代码为: StringBuilder sb = new StringBuilder(); sb.Append("function callWebService(){\n"); sb.Append("WebService.ReturnServerTime('yyyy-MM-dd mm:ss',onOk);\n"); sb.Append("}\n"); sb.Append("function onOk(returnData){\n"); sb.Append("$('TextBox1').value=returnData;\n"); sb.Append("}\n"); this.ClientScript.RegisterClientScriptBlock(this.GetType(), "abc", sb.ToString(), true); this.ScriptManager1.Services.Add(new ServiceReference("WebService.asmx"));
- 2 回答
- 0 关注
- 430 浏览
添加回答
举报
0/150
提交
取消