```
<div class="denglu_pas">
<div id="embed-captcha"></div>
<p id="wait" class="show">正在加载验证码......</p>
<p id="notice" class="hide" style="font-size: 14px;">请先完成验证</p>
</div>
```
```
<script>
var handlerEmbed = function (captchaObj) {
$(".bn").click(function (e) {
var validate = captchaObj.getValidate();
if (!validate) {
$("#notice")[0].className = "show";
setTimeout(function () {
$("#notice")[0].className = "hide";
}, 2000);
e.preventDefault();
}
});
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
captchaObj.appendTo("#embed-captcha");
captchaObj.onReady(function () {
$("#wait")[0].className = "hide";
});
};
$.ajax({
url: "{:U('get_geetest_status')}",
type: "post",
dataType: "json",
success: function (data) {
console.log(data);
initGeetest({
gt: data.gt,
challenge: data.challenge,
new_captcha: data.new_captcha,
product: "embed",
offline: !data.success
}, handlerEmbed);
}
});
</script>
```