• Ajax.BeginForm 用法


    例子:

    @{
        ViewBag.Title = "Home Page";
    }
    <!--需引入js文件--> <script src="http://966800.com/scripts/jquery.js"></script> <script src="http://966800.com/scripts/js/junobtrusiveam.js"></script> <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p> </div>
    <!--使用--> <div class="row"> @using (Ajax.BeginForm("show", "home", new AjaxOptions { OnSuccess = "successg(data)", OnFailure = "failure(data)", LoadingElementId = "ajax-loader", //显示正在加载 UpdateTargetId = "list" //指向id=list })) { <input name="ttt" type="text" /> <input type="submit" value="提交" /> } <div id="list"></div> <div id="ajax-loader" style="285px;margin:auto;font-size: 18px;display:none;"> <img src="~/Content/5-121204193R5-50.gif" style="40px; " />数据正在加载,请稍后。。。 </div> </div> <script> function successg(data) { alert("成功"); } function failure(data) { alert("失败"); } </script>

    控制器:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace WebApplication1.Controllers
    {
        public class HomeController : Controller
        {
            public ActionResult Index()
            {
                return View();
            }
            public ActionResult Show(string ttt)
            {
                ViewBag.Message = ttt;
                return View();
            }
        }
    }
    

      

      

  • 相关阅读:
    python------面向对象介绍
    python------模块定义、导入、优化 ------->re模块
    python------模块定义、导入、优化 ------->hashlib模块
    Java过滤器Filter使用详解
    EL表达式、 jstl标签
    jsp 自定义标签中的Function函数
    JSP 自定义标签
    javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String
    JSP 中EL表达式用法详解
    JavaWEB
  • 原文地址:https://www.cnblogs.com/lemonmoney/p/10081755.html
Copyright © 2020-2023  润新知