$("#wait")[0].className = "hide"; }); captchaObj.onSuccess(function () { setTimeout(function () { cdivCL(); sendMessage(); }, 2000); $(".email_subscribe").click(function(event) { email_subbit(); }); }); }; $.ajax({ // 获取id,challenge,success(是否启用failback) url: "/gt3_php/web/StartCaptchaServlet.php?t=" + (new Date()).getTime(), // 加随机数防止缓存 type: "get", dataType: "json", success: function (data) { console.log(data); initGeetest({ gt: data.gt, challenge: data.challenge, new_captcha: data.new_captcha, product: "popup", offline: !data.success }, handlerEmbed); } }); function email_subbit() { var email = $("#subscribe_pemail").val(); var code = $("#subscribe_code").val(); var firstname = $("#property1").val(); var lastname = $("#property2").val(); var password = $("#property4").val(); var dealType = 2000; //验证方式 console.log(password); var cid = document.domain; //获取域名 $.ajax({ type: "POST", //用POST方式传输 dataType: "JSON", //数据格式:JSON url: '/e/api/common/register/index.php', //目标地址 data: "type=" + dealType + "&email=" + email + "&firstname=" + firstname+ "&lastname=" + lastname + "&password=" + password + "&code=" + code + "&cid=" + cid, error: function(res) { console.log(res); }, success: function(res) { if (res.code == 200) { layer.ready(function(){ layer.msg(res.msg, { time:3000, anim: 0 }); }); $("#btnSendform").hide(); // window.location.href="/user/account.html"; window.open('/coupon/my.php', '_blank', 'height=777, width=433, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no, directories=no'); } else if (res.code == 100) { layer.ready(function(){ layer.msg(res.msg, { time:3000, anim: 0 }); }); $("#btnSendform").hide(); // window.location.href="/user/account.html"; window.open('/coupon/my.php', '_blank', 'height=777, width=433, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no, directories=no'); } else { layer.ready(function(){ layer.msg(res.msg, { time:3000, anim: 0 }); }); return false; } } }); }