Blogger Information
Blog 91
fans 2
comment 4
visits 127896
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
10行JQ搞定短信验证码发送
夏日的烈风的博客
Original
886 people have browsed it

(".code").on("click", function() {

    var s = parseInt($(".code b").html());

    var phone = $("#phone").val();

    if (s > 0) {

        layer.msg("请等待" + s + "秒重发")

        return false;

    }

    $.post("{:U('code')}", {

        phone: phone

    }, function(e) {

        if (e.status == 1) {

            $(".code").html("等待<b>60</b>秒");

            var ping = window.setInterval(function() {

                var s = parseInt($(".code b").html());

                if (s == 0) {

                    $(".code").html("重发验证码")

                    clearInterval(ping);

                    return false;

                } else {

                    $(".code b").html(s - 1);

                }

            }, 1000);

        } else {

            layer.msg(e.info);

        }

    });

    return false;

})


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post