The main is to realize the success of the asynchronous mobile phone sent SMS in the AJAX success callback in the implementation will send the button to set the Ash and countdown, just started to report JS error, the problem may be that after invoking Ajax this is updated, at any time before this object assigned to a variable is no problem
Button Countdown Code
Copy Code code as follows:
var wait = 60;
Get_code_time = function (o) {
if (wait = = 0) {
O.removeattribute ("Disabled");
O.value = "Free access to verification code";
wait = 60;
} else {
O.setattribute ("Disabled", true);
O.value = "(" + wait + + ") seconds to retrieve again";
wait--;
settimeout (function () {
Get_code_time (o)
}, 1000)
}
}
Call Get_code_time function code after getting SMS
Copy Code code as follows:
//re-acquire Authenticode
$ (' #codeagain '). Click (function () {
var o = this;
$.ajax ({
URL: "tea_sendcode.action?jsoncallback=?",
Type: "POST",
Data: {Accountid:accountid},
D Atatype: "JSON",
Success:function (data) {
if (data.status = 1 && data.code = =) {
Alert ("Authenticode Sent to your phone ");
Get_code_time (o);
} else {
if (data.msg!= "") {
alert (data.msg);
} else {
alert ("SMS authentication code failed to send)";
}
}
},
Error:function (data) {
if (Data.status = = 0) {
alert (data.msg);
} else {
alert ("SMS authentication code failed to send)";
}
}
});
});