logoDocument
Search
Login

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(){...})})
              
              initGeetest({...},function(gt){
    gt.onReady(function(){...})})

            
This code block in the floating window

onShow(definition)

Triggered when the verification window is displayed.

Parameters

  • { Function } definition

Usage

initGeetest({...},function(gt){ gt.onShow(function(res){...})})
              
              initGeetest({...},function(gt){
    gt.onShow(function(res){...})})

            
This code block in the floating window

onClose(definition)

Triggered when the verification window is hidden.

Parameters

  • { Function } definition

Usage

initGeetest({...},function(gt){ gt.onClose(function(){...})})
              
              initGeetest({...},function(gt){
    gt.onClose(function(){...})})

            
This code block in the floating window

onSuccess(definition)

Triggered upon successful verification.

Parameters

  • { Function } definition

Usage

initGeetest({...},function(gt){ gt.onSuccess(function(res){// Result of successful verification console.log(res)...})})
              
              initGeetest({...},function(gt){
    gt.onSuccess(function(res){// Result of successful verification
        console.log(res)...})})

            
This code block in the floating window

onFail(definition)

Triggered upon verification failure.

Parameters

  • { Function } definition

Usage

initGeetest({...},function(gt){ gt.onFail(function(res){// Result of failed verification console.log(res)...})})
              
              initGeetest({...},function(gt){
    gt.onFail(function(res){// Result of failed verification
        console.log(res)...})})

            
This code block in the floating window

onError(definition)

Triggered upon verification error.

Parameters

  • { Function } definition

Usage

initGeetest({...},function(gt){ gt.onError(function(err){// Result of verification error console.log(err)...})})
              
              initGeetest({...},function(gt){
    gt.onError(function(err){// Result of verification error
        console.log(err)...})})

            
This code block in the floating window

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'))})})
              
              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'))})})

            
This code block in the floating window

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()})})
              
              initGeetest({...},function(gt){
    gt.onReady(function(){// Use showCaptcha to customize triggering the verification window // Example: trigger immediately after verification is ready
        gt.showCaptcha()})})

            
This code block in the floating window

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()})})
              
              initGeetest({...},function(gt){
    gt.onError(function(){...
      gt.reset()})

    gt.onSuccess(function(){...
      gt.reset()})})

            
This code block in the floating window

destroy()

Destroys the verification code.

Usage

initGeetest({...},function(gt){ gt.onSuccess(function(){... gt.destroy()})})
              
              initGeetest({...},function(gt){
    gt.onSuccess(function(){...

      gt.destroy()})})

            
This code block in the floating window
icon
Contact Sales