Send random number phone verification code 60 seconds countdown
Mm.mobilecheck = function (t) {var mobile = $ ("#user_mobile"). Val (); if ("===$.trim (Mobile)") {$.sscmpmsg (). Showwarnmessage ("Please enter your mobile phone number! "); Return } $ (T). attr (' disabled ', ' disabled '); var chars = [' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ']; var code = []; Code.push (Chars[parseint (10*math.random ())); Code.push (Chars[parseint (10*math.random ())); Code.push (Chars[parseint (10*math.random ())); Code.push (Chars[parseint (10*math.random ())); var codestr = Code.join ("); Mm.apiajax ({url:path.u ('/index/sms/registercard '), data: { User_mobile:mobile, Code:codestr}, Success:function (data) {} }); $ ("#mobile_code"). Val (CODESTR); var s = 60; var task = setinterval (function () {if (s<1) {clearinterval (Task); $ (t). removeattr (' disabled '); $ (t). Text ("Resend"); Return } s = s-1; $ (t). Text (s.tostring () + "seconds"); }, 1000); }
JS Small function implementation