[TOC]
### 引入文件
```
<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
```
### 按钮使用:
#### 获取方法1
```
<div class="weui-vcode-btn ea55_a" style=" width: 115px; "
id="TencentCaptcha"
data-appid="2067609981"
data-cbfn="callback"
type="button" onclick="" >获取验证码</div>
```
#### 获取方法2
```
//方法1: 直接生成一个验证码对象
var captcha1 = new TencentCaptcha('2067609981', function(res) {
/* callback */
});
captcha1.show(); // 显示验证码
```
### 监听回调
```
window.callback = function(res){
console.log(res)
// res(用户主动关闭验证码)= {ret: 2, ticket: null}
// res(验证成功) = {ret: 0, ticket: "String", randstr: "String"}
if(res.ret === 0){
// alert(res.ticket) // 票据
// ea55_yanzhengma2();
}
}
```