zoukankan      html  css  js  c++  java
  • MVC 3.0 MicrosoftAjax 的使用

    @model TestMVC.Areas.WebSite.Models.TestModel
    @{
        ViewBag.Title = "Index";
    }
    <h2>
        Index</h2>
    <script src="http://www.ideaam.com/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="http://www.ideaam.com/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    <script src="http://www.ideaam.com/Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
    <script src="http://www.ideaam.com/Scripts/jquery.unobtrusive-ajax.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        
    var ideaam = (function ($) {
            
    return {
                success: 
    function (data) {
                    Result.innerHTML 
    = Result.innerHTML + "success";
                },
                failure: 
    function () {
                    alert(
    "failure");
                }
            }
        } (ideaam));

        
    </script>
    @using (Ajax.BeginForm("Test", "Home", new AjaxOptions
    {
        HttpMethod = "Post",
        OnSuccess = "ideaam.success",
        OnFailure = "ideaam.failure",
        UpdateTargetId = "ajaxResult",
        InsertionMode = InsertionMode.Replace
    }))
    {
        @Html.Label(Model.ID.ToString()); 
        <span style="margin-left: 10px; float: left;"></span>
        @Html.TextBoxFor(m => m.Title, "Title");
        <span style="margin-left: 10px; float: left;"></span>
        @Html.TextBoxFor(m => m.Description, "Description");
        
        <input type="submit" value="Submit" />
    }
    <div id="ajaxResult">
    </div>
    <div id="Result">
    </div>
  • 相关阅读:
    Facade
    Adapter
    Bridge
    Factory
    Singleton
    Decorator
    Template Method
    设计模式
    寻找最小的k个数
    java并发编程(4)--线程池的使用
  • 原文地址:https://www.cnblogs.com/haoliansheng/p/2660551.html
Copyright © 2011-2022 走看看