DTcms.Web/templates/main/js/register-validate.js

(完整代码) 1KB

//=====================初始化代码======================
$(function () {
	//同意条款
	$("#chkAgree").click(function () {
		if ($(this).is(":checked")) {
			$("#btnSubmit").prop("disabled", false);
		} else {
			$("#btnSubmit").prop("disabled", true);
		}
	});
	
    //初始化验证表单
	$("#regform").Validform({
		tiptype:3,
		callback:function(form){
			//AJAX提交表单
            $(form).ajaxSubmit({
                beforeSubmit: showRequest,
                success: showResponse,
                error: showError,
                url: $("#regform").attr("url"),
                type: "post",
                dataType: "json",
                timeout: 60000
            });
            return false;
		}
	});

    //表单提交前
    function showRequest(formData, jqForm, options) {
		$("#btnSubmit").val("正在提交...")
        $("#btnSubmit").prop("disabled", true);
        $("#chkAgree").prop("disabled", true);
    }
    //表单提交后
    function showResponse(data, textStatus) {
        if (data.status == 1) { //成功
			var d = dialog({content:data.msg}).show();
			setTimeout(function () {
				d.close().remove();
				location.href = data.url;
			}, 2000);
        } else { //失败
            dialog({title:'提示', content:data.msg, okValue:'确定', ok:function (){}}).showModal();
            $("#btnSubmit").val("再次提交");
            $("#btnSubmit").prop("disabled", false);
            $("#chkAgree").prop("disabled", false);
        }
    }
    //表单提交出错
    function showError(XMLHttpRequest, textStatus, errorThrown) {
        dialog({title:'提示', content:"状态:" + textStatus + ";出错提示:" + errorThrown, okValue:'确定', ok:function (){}}).showModal();
        $("#btnSubmit").val("再次提交");
        $("#btnSubmit").prop("disabled", false);
        $("#chkAgree").prop("disabled", false);
    }
});

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。