惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
Y
Y Combinator Blog
B
Blog RSS Feed
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
L
LangChain Blog
IT之家
IT之家
F
Fortinet All Blogs
V
V2EX
C
Check Point Blog
The Cloudflare Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans

博客园 - 许晓光

四舍五入 - 许晓光 - 博客园 ASP.NET 2.0 - 控件系列(四) – GridView绑定 - 许晓光 ASP.NET Video Streaming 在线视频播放 - 许晓光 C#调用dos命令 SQL – Select查询的多种方法 ASP.NET MVC 学习心得 (6) –jQuery取得控件值 - 许晓光 ASP.NET MVC 学习心得 (4) – 视图控制器 ASP.NET 事件冒泡技术 ASP.NET MVC 学习心得 (3) – 怎样使用服务器控件 ASP.NET MVC 学习心得 (2) - 怎样创建自定义URL Routing ASP.NET MVC 学习心得 (1) - 怎样创建简单程序 一个非常简单的C#面试题 C# Object Initialization SQL Server 性能优化(4) – Performance – Indexed Views SQL Server 性能优化(3) – Performance - DataTypes SQL – Sub Query SQL - TOP ASP.NET – Master Page 和Content Page事件执行顺序 ASP.NET 中使用Windows Live ID 验证登录
ASP.NET MVC 学习心得 (5) –AJAX - 许晓光
许晓光 · 2009-04-21 · via 博客园 - 许晓光
  1. 添加视图

    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script language="javascript" type="text/javascript" src="/Scripts/jquery-1.2.6.min.js"></script>

    <script language="javascript" type="text/javascript">

    function HelloJquery()

    {

    $.ajax(

    {

    url: "HelloJason",

    type:"POST",

    datatype : "json",

    timeout : 1000,

    success: GetResult

    }

    );

    }

    function GetResult(result)

    {

    alert(result.toString());

    }

    </script>

    <h2>Async</h2>

    <input type="button" value="Get Server Data" onclick="HelloJquery()" />

    </asp:Content>

  2. 添加控制器

    public ActionResult HelloJason()

     {

    return this.Json("From server");

}

posted @ 2009-04-21 10:51  许晓光  阅读(228)  评论()    收藏  举报