1.配置web.config (直接选择ASP.NET AJAX项目就不用特别配置了)
2.新建web服务:testws.asmx
3.在testws.cs文件中添加属性:(这点最重要)
[System.Web.Script.Services.ScriptService()]4.新建aspx文件:
添加一个ScriptManager:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="hotdataws.asmx" />
</Services>
</asp:ScriptManager>5.添加一个HTML button,onclick事件:
<input id="button" type="button" value="调 用" onclick="return OnbuttonGo_click()" />6.JAVASCRIPT中添加事件:
function Button1_onclick() {
HelloWorld(Oncomplete);
} 
Oncomplete(args){
alert(args);
}


浙公网安备 33010602011771号