Php OpenCart-如何在单击时重新加载验证码图像?
有很多关于如何在点击时重新加载验证码图像的例子,它们都有一个“captcha.php”作为图像源,例如Php OpenCart-如何在单击时重新加载验证码图像?,php,image,opencart,captcha,reload,Php,Image,Opencart,Captcha,Reload,有很多关于如何在点击时重新加载验证码图像的例子,它们都有一个“captcha.php”作为图像源,例如 <img id="captcha" src="captcha.php"> <a id='reload'>Refresh now</a> $('#reload').click(function(){ $('#captcha').attr('src','captcha.php') }) 现在刷新 $(“#重新加载”)。单击(函数(){ $('#c
<img id="captcha" src="captcha.php">
<a id='reload'>Refresh now</a>
$('#reload').click(function(){
$('#captcha').attr('src','captcha.php')
})
现在刷新
$(“#重新加载”)。单击(函数(){
$('#captcha').attr('src','captcha.php'))
})
我的表单中OpenCart中的图像源是
<img id="captcha_img" src="index.php?route=information/contact/securimage" alt="CAPTCHA Image" />
如果我这样做:
<script>
$(function() {
$('#captcha_img').click(function(){
$('img').attr('src', '<?php echo "index.php?route=information/contact/securimage" ?>?' + (new Date).getTime());
});
});
</script>
$(函数(){
$('captcha\u img')。单击(函数(){
$('img').attr('src','?'+(新日期).getTime());
});
});
第一个图像加载,但当我点击图像时,新图像不会加载。看起来我没有指定正确的URL。我需要在OpenCart中的脚本中设置什么路径?谢谢。
<script>
$(function() {
$('#captcha_img').click(function(){
$(this).attr('src', '<?php echo "index.php?route=information/contact/securimage" ?>&time=' + (new Date).getTime());
});
});
</script>
$(函数(){
$('captcha\u img')。单击(函数(){
$(this.attr('src','&time='+(新日期).getTime());
});
});
这样行吗?
$(函数(){
$('captcha\u img')。单击(函数(){
$(this.attr('src','&time='+(新日期).getTime());
});
});
这样行吗?行!非常感谢你,伙计!非常感谢,真的!非常感谢你,伙计!非常感谢。