• MVC5异步提交表单疑难杂症


    //此处必须添加,不然不能执行异步回调OnAddPortSuccess方法

     <script src="~/scripts/jquery.unobtrusive-ajax.min.js"></script>

    <script type="text/javascript">
    function OnAddPortSuccess(data) {
    var excuteResult = $.parseJSON(data);
    alert(excuteResult.toString());
    }
    </script>


    <h2>UserPorts</h2>
    @using (Ajax.BeginForm("AddPort", new AjaxOptions()
    {
    OnSuccess = "OnAddPortSuccess"
    }))

    {.....}

    //由于MVC5 新建项目里不包含jquery.unobtrusive-ajax.js

     //

    异步上传文件,需要引入<script src="~/scripts/jquery.form.js"></script>

  • 相关阅读:
    0531day05
    0530day04
    0529day03
    0528day02
    0527day01
    0527学习心得
    javascript 2
    javascript
    CSS
    CSS知识
  • 原文地址:https://www.cnblogs.com/pylblog/p/7518954.html
Copyright © 2020-2023  润新知