我想创建一个Captcha来在我的网站上添加新用户。为此,我尝试使用CaptchaMvc.Mvc5
,但它没有显示de refresh按钮来更改验证码图像。
查看Chrome的开发人员检查,它有一个关于Uncaught ReferenceError: $ is not defined at add:271
的例外情况,我认为这是问题,然后,此行中的代码由CaptchaMvc.Mvc5
生成。
第271行
<div class="text-center">
<script type="text/javascript">
$(function () {$('#0e12b41cddf84cd6a548118316ab8aed').show();}); //line 271
function ______3eec991ccebe425ba220485ba983374e________() { $('#0e12b41cddf84cd6a548118316ab8aed').hide(); $.post("/DefaultCaptcha/Refresh", { t: $('#CaptchaDeText').val() }, function(){$('#0e12b41cddf84cd6a548118316ab8aed').show();}); return false; }</script>
<br/>
<img id="CaptchaImage" src="/DefaultCaptcha/Generate?t=d230fe1e79a3448f987705cf22a90432"/><input id="CaptchaDeText" name="CaptchaDeText" type="hidden" value="d230fe1e79a3448f987705cf22a90432" /> <br/><a href="#CaptchaImage" id="0e12b41cddf84cd6a548118316ab8aed" onclick="______3eec991ccebe425ba220485ba983374e________()" style="display:none;">Refresh</a><br/>Digite o texto da imagem acima<br/><input autocomplete="off" autocorrect="off" data-val="true" data-val-required="Texto requerido" id="CaptchaInputText" name="CaptchaInputText" type="text" value="" /><br/><span class="field-validation-valid" data-valmsg-for="CaptchaInputText" data-valmsg-replace="true"></span>
<span class="field-validation-valid" data-valmsg-for="CaptchaInputText" data-valmsg-replace="true"></span>
</div><!--/captcha-->
我该如何解决?
我的Html
@{
var captcha = Html.Captcha("Refresh", "Digite o texto da imagem acima", 5, "Texto requerido", true);
}
<div class="text-center">
@captcha
@Html.ValidationMessage(captcha.BuildInfo.InputElementId)
</div><!--/captcha-->