Copy Code code as follows:
var wait=60;//time
function Time (o,p) {//o is the object of the button, p is optional, here is 60 seconds later, prompt text changes
if (wait = = 0) {
O.removeattr ("Disabled");
O.val ("Click Send Verification Code");/change the value of the button
P.html ("If you do not receive the verification code within 1 minutes, please check that your mobile phone number is correct or resend");
wait = 60;
} else {
O.attr ("Disabled", true)//No click button during countdown
O.val (wait + seconds to retrieve verification code);/Change the value of the button
wait--;
settimeout (function () {
Time (o,p);//Loop call
},
1000)
}
}
View:
Copy Code code as follows:
<input class= "mem_btn mem_btn26" type= "Submit" Name= "Yt0" value= "Click Send Authentication Code" id= "BTN" >
Call:
Copy Code code as follows:
echo Chtml::ajaxsubmitbutton (' Click to send verification code ',
Chtml::normalizeurl (
Array ('/ajax/sendgetpassmobilcaptcha ', ' zm_id ' => $model->zm_id)
),
Array (' Success ' => ' function (result) {
if (result==1) {
$ (". ys_98"). HTML ("Verification code sent successfully, please check your phone in time.") ");
Time ($ ("#yt0"), $ (". ys_98"))
}else{
$ (". ys_98"). HTML ("Authentication code send failed, please try again, or contact the administrator.") ");
}
} ', ' Data ' => ' zm_id= '. $model->zm_id. " &zm_mob= ". $model->zm_mob." &zm_name= ". $model->zm_name
),
Array (' class ' => ' mem_btn mem_btn26 '));