API Guide
onReady(definition)
Triggered when the verification code completes initialization and the required resources are fully loaded.
Parameters
{ Function } definition
Usage
initGeetest({...},function(gt){
gt.onReady(function(){...})})
onShow(definition)
Triggered when the verification window is displayed.
Parameters
{ Function } definition
Usage
initGeetest({...},function(gt){
gt.onShow(function(res){...})})
onClose(definition)
Triggered when the verification window is hidden.
Parameters
{ Function } definition
Usage
initGeetest({...},function(gt){
gt.onClose(function(){...})})
onSuccess(definition)
Triggered upon successful verification.
Parameters
{ Function } definition
Usage
initGeetest({...},function(gt){
gt.onSuccess(function(res){// Result of successful verification
console.log(res)...})})
onFail(definition)
Triggered upon verification failure.
Parameters
{ Function } definition
Usage
initGeetest({...},function(gt){
gt.onFail(function(res){// Result of failed verification
console.log(res)...})})
onError(definition)
Triggered upon verification error.
Parameters
{ Function } definition
Usage
initGeetest({...},function(gt){
gt.onError(function(err){// Result of verification error
console.log(err)...})})
appendTo(options)
Used to mount the built-in button for triggering the verification window to a specified location. options accepts an id or class selector, or a complete DOM element. Effective when the configuration parameter product is not set to bind.
Parameters
{ Object|String } options
Usage
initGeetest({...},function(gt){
gt.onReady(function(){// Add the built-in button to the end of the specified element // Supports the following three methods // Example <div id="captcha_wrap" class="captcha-wrap"></div>
gt.appendTo('#captcha_wrap')
gt.appendTo('.captcha-wrap')
gt.appendTo(document.getElementById('captcha_wrap'))})})
showCaptcha()
After the verification code is initialized, the verification window can be triggered. The built-in button event will trigger the verification window. Effective when the configuration parameter product is set to bind.
Usage
initGeetest({...},function(gt){
gt.onReady(function(){// Use showCaptcha to customize triggering the verification window // Example: trigger immediately after verification is ready
gt.showCaptcha()})})
reset()
Resets the verification code, effective only when verification is successful or an error occurs.
Usage
initGeetest({...},function(gt){
gt.onError(function(){...
gt.reset()})
gt.onSuccess(function(){...
gt.reset()})})
destroy()
Destroys the verification code.
Usage
initGeetest({...},function(gt){
gt.onSuccess(function(){...
gt.destroy()})})









