新建一个网站,添加一个空白页,拖放Ajax Extensions中的ScriptManager到页面上,托放一个Html的Input(Text)和Input(Button)
新建一个Web Service,将其命名为SimpleService,将其HelloWorld()方法改成SayHello,将代码改成
去掉上面[System.Web.Script.Services.ScriptService]的注释,以便能让script访问这个服务
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
在SimpleService.asmx上右键View in Browser 在网页中查看服务是否正常运行
返回到之前新建的空白页上面,双击Button,在上面添加如下Js语句
运行网站后看到效果,点击Button,在Textbox输入username,填出窗口Hello:XXX