You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<img id="capt" src=""/><br/>
|
|
<input id="captvalue" placeholder="请输入验证码"/><br/>
|
|
<input type="button" name="save" value="提交" onclick="submit()"/>
|
|
<script>
|
|
var curCaptId = "";
|
|
//得到图形验证码和id
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "/dsSzxy/captchaRelate/getCaptcha",
|
|
data: {},
|
|
dataType: "JSON",
|
|
success: function (result) {
|
|
curCaptId = result.captcha.id;
|
|
document.getElementById("capt").src = result.captcha.base_64_blob;
|
|
}
|
|
});
|
|
|
|
//提交验证码和id
|
|
function submit() {
|
|
var capt = document.getElementById("captvalue").value;
|
|
var postdata = {
|
|
"id": curCaptId,
|
|
"capt": capt
|
|
};
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/dsSzxy/captchaRelate/verifyCaptcha",
|
|
data: postdata,
|
|
dataType: "JSON",
|
|
success: function (result) {
|
|
console.log(result.success);
|
|
if (result.success) {
|
|
alert("验证成功");
|
|
} else {
|
|
alert("验证错误!" );
|
|
}
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|