技术开发 频道

AJAX在客户端Javascript中调用Webservice

    二、前台页面:
    注意要点:
    需要使用的后台WebService的方法均设置在如下位置 
<asp:ScriptManager ID="ScriptManager1" runat="server"> 
<Services> 
<asp:ServiceReference Path="~/WS.asmx" /> 
<asp:ServiceReference Path="~/WS1.asmx" /> 
</Services>
6 </asp:ScriptManager> 
     Default页面: 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<title>Untitled Page</title> 
<script language="JavaScript" type="text/javascript" src="js.js"> 
</script> 
</head> 
<body> 
<form id="form1" runat="server"> 
<asp:ScriptManager ID="ScriptManager1" runat="server"> 
<Services> 
<asp:ServiceReference Path="~/WS.asmx" /> 
<asp:ServiceReference Path="~/WS1.asmx" /> 
</Services> 
</asp:ScriptManager> 
<div> 
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="dd();return false;" /> 
<div id="time"> 
</div> 
<div id="List1"> 
<asp:DropDownList ID="ddl1" runat="server" Width="187px"> 
</asp:DropDownList> 
</div> 
</div> 
</form> 
</body> 
</html>
0
相关文章