• Js 一些方法(一)


    (function ($) {
        var promoter = promoter || {};
        promoter.utils = (function () {
            var controller = "../promoter";
            var pro = function () {
                $("#email").on("blur", function () {
                    ValEmail("email");
                });
                $("#application").on("click", function () {
                    var email = $("#email").val(); 
                    if (!ValEmail("email")) {
                        return false;
                    } 
                    var arr = $("#email").val().replace(";", ";").split(";");
                    var data = { 'email': arr };
                    $.ajax({
                        type: "post",
                        url: "promoter/index",
                        data: data,
                        dataType: 'json',
                        success: function (data) {
                            if (data.state == "success") {
                                alert("Hello");
                            } else {
                                alert("Faile");
                            }
                        }
                    });
    
                });
            };
            return {
                pro: pro
            };
        }());
    
        $(function () {
            promoter.utils.pro();
        })
    })(jQuery);
    
    function ValEmail(em) {
        if ($("#" + em).val() == "") {
            $("#confirmMsg").html("<font color='red'>请输入审批人邮箱!</font>");
            $("#" + em).focus();
            return false;
        } else {
            var arr = $("#" + em).val().replace(";", ";").split(";");
            for (var i = 0; i < arr.length; i++) {
                if (!arr[i].match(/^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$/)) {
                    $("#confirmMsg").html("<font color='red'>当前'" + arr[i] + "'邮箱格式不正确!请重新输入!</font>");
                    $("#" + em).focus();
                    return false;
                } else {
                    $("#confirmMsg").html("");
                }
            }
            return true;
        }
    }
  • 相关阅读:
    0109. Convert Sorted List to Binary Search Tree (M)
    03.Linux基础操作
    02windows基础操作
    API接口幂问题
    RocketMQ
    zookeeper
    JVM之参数调优
    JAVA多线程之线程池
    计算机网络常见问题
    英语词性之名词
  • 原文地址:https://www.cnblogs.com/PEPE/p/4561222.html
Copyright © 2020-2023  润新知