这次,我们练习MVC应用程序中,应用web service。
先在MVC应用程序中创建一个目录Services,将用来存储Service.asmx。

这个Service的方法,可以参考这个《

在Controllers目录下创建一个ExerciseController.cs和一个视图ActionResult:
MVC应用程序使用Web Services(asmx)


在MVC5创建好Controller之后,自动会在Views目录下面创建好相关的视图目录:
MVC应用程序使用Web Services(asmx)


创建视图:
MVC应用程序使用Web Services(asmx)


在#3步,我们写jquery代码,获得Web Server返回的数据:
MVC应用程序使用Web Services(asmx)


实时演示:
MVC应用程序使用Web Services(asmx)

  

以下内容于2014-03-14 16:30分补充。
两个Click的事件处理逻辑一样的,可以重构为一个扩展方法:
MVC应用程序使用Web Services(asmx)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2021-08-27
  • 2022-01-08
猜你喜欢
  • 2021-07-06
  • 2022-12-23
  • 2021-06-16
  • 2021-09-03
  • 2021-11-11
  • 2021-12-04
  • 2021-07-09
相关资源
相似解决方案