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>");
            }
        }
  • 相关阅读:
    大数据项目实战之在线教育(01数仓需求)
    大数据项目实战之在线教育(02数仓实现)
    大数据之flink教程-TableAPI和SQL
    尚硅谷大数据技术之电商用户行为数据分析
    大数据实时项目(采集部分)
    大数据实时项目(交易额)
    作业一
    预备作业
    重建二叉树
    矩形覆盖
  • 原文地址:https://www.cnblogs.com/RobotTech/p/2126934.html
Copyright © 2011-2022 走看看