zoukankan      html  css  js  c++  java
  • jquery 在MVC模式异步回调检验逻辑

    前台:

     <script type="text/javascript">
            //验证模板名称
            function ValidateName() {

                var result = false;
                $("#ValidateName").empty();
                var TempCatName = $.trim($("#TempCatName").val());

                //增加对模板名称的校验
                $.ajaxSettings.async = false;
                $.getJSON("CheckTempNameIsUse", { TempName: spanTempNameIsUse }, function(data) {
                    if (data.hadsys == false) {
                        $("#spanTempNameIsUse").show();
                        result = false;
                    }
                    else {
                        $("#spanTempNameIsUse").hide();
                    }
                });

                return result;
            }

     </script>

    后台:

       在同一个Control中写:

            #region 检查模板名称是否相同

            /// <summary>
            /// 检查模板名称是否相同
            /// </summary>
            /// <param name="TempName">模板名称</param>
            [SecureFilter(ISSecure = true)]
            public ActionResult CheckTempNameIsUse(string TempName)
            {
                bool returnValue = true;

                returnValue = wcfApiProvider.Template_ExistsTemplateInfoByTemplateName(TempName);
                //returnValue = true;
                return base.Json(new { hadsys = returnValue, msg = "检查模板名称是否相同" }, JsonRequestBehavior.AllowGet);
            }

            #endregion

  • 相关阅读:
    Webfunny Js错误分析讲解
    Webfunny漏斗分析功能讲解
    Webfunny自定义埋点功能讲解
    Webfunny连线用户功能讲解
    Webfunny用户细查功能讲解
    C语言打印数字前补0
    github上新晋star3K的开源AI模型,包含情感分析等
    IT系统架构的演化
    微服务架构与SOA架构的区别与联系
    开源的分布式事务-Seata的设计原理
  • 原文地址:https://www.cnblogs.com/a311300/p/1794328.html
Copyright © 2011-2022 走看看