zoukankan      html  css  js  c++  java
  • ASP.NET MVC2 in Action 读书笔记 [122] Ajax with MVC

    Index.aspx:

    <script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
        
        <script type="text/javascript">
            function getMessage() {
                $.get("/SimpleAjax/GetMessage", function(data) {
                    $("#result").html(data);
                });
            }
        </script>
     
    <button type="button" onclick="getMessage();">Get the Message!</button>
    <div id="result"></div>

    SimpleAjaxController.cs:

    public class SimpleAjaxController : Controller
        {   
            public ActionResult Index()
            {
                return View();
            }
     
            public ActionResult GetMessage()
            {
                return Content("<h1>This is a custom message returned from an action.</h1>");
            }
        }
  • 相关阅读:
    用于Web开发的8 个最好的跨平台编辑器
    javascript之数组操作
    15 个最佳的 jQuery 表格插件
    使用Backbone构建精美应用的7条建议
    linux内核内存分配(一、基本概念)
    redhat的systemd版本list
    Linux内核crash/Oops异常定位分析方法
    systemd bug: bz1437114 core:execute: fix fork() fail handling in exec_spawn()
    Use gdb attach pid and debug it
    Build rpm example:zram
  • 原文地址:https://www.cnblogs.com/RobotTech/p/2126934.html
Copyright © 2011-2022 走看看