Thinkphp learning and using at the same time - Verification code unintentional mistakes
Look at the code first:
1 $(".verify_img").click(function(){
2 var timenow = new Date().getTime();
3 var url="{:U('index/loginverify')}&t="+timenow;
4 alert(url);
5 $(this).attr("src",url)
6 });
The above code causes the verification code to be clicked to switch and the verification code image cannot be displayed.
Look at the following code again:
$(".reloadverify").click(function(){
var timenow = new Date().getTime();
var url="{:U('index/loginVerify')}?t="+timenow;
$("#image_d").attr("src",url)
});
What is the area of the above code? The difference between &. After comparison, you can see where the problem lies. It is also valid to directly follow a random number after the question mark. var url="{:U('index/loginVerify')}?"+Math.random();
The problem is already very clear when I write this.
http://www.bkjia.com/PHPjc/890646.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/890646.htmlTechArticleThinkphp Learn and use - Verification code unintentional mistakes. Look at the code first: 1 $(.verify_img). click(function(){ 2 var timenow = new Date().getTime(); 3 var url ={:U(index/loginverify)}t=+time...