源码参考:链接:http://pan.baidu.com/s/1pKhHHMj  密码:mkr4

1:新建-->项目-->Web-->ASP.NET MVC 4 Web 应用程序。命名为:Mvc4MicrosoftAjaxDemo

MVC4 AspNet MVC下的Ajax / 使用微软提供的Ajax请求脚本 [jquery.unobtrusive-ajax.min.js]

2:新建控制器:在Controllers文件夹上 右键-->添加-->控制器,命名为:HomeController (HomeController .cs)

MVC4 AspNet MVC下的Ajax / 使用微软提供的Ajax请求脚本 [jquery.unobtrusive-ajax.min.js]

3:在控制器HomeController中新增Action: GetDate()

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Threading;
 5 using System.Web;
 6 using System.Web.Mvc;
 7 
 8 namespace Mvc4MicrosoftAjaxDemo.Controllers
 9 {
10     public class HomeController : Controller
11     {
12         //
13         // GET: /Home/
14 
15         public ActionResult Index()
16         {
17             return View();
18         }
19 
20         public ActionResult GetDate()
21         {
22             //休眠1秒钟,监控前台动作
23             Thread.Sleep(1000);
24             return Content(DateTime.Now.ToString());
25         }
26     }
27 }
HomeController.cs

相关文章:

  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-07-04
  • 2021-12-18
  • 2021-06-26
  • 2021-11-27
猜你喜欢
  • 2021-07-25
  • 2021-07-01
  • 2021-11-21
  • 2022-12-23
  • 2021-11-29
  • 2021-11-29
相关资源
相似解决方案