How can I create a “Please Wait, Loading…” animation using jQuery?

后端 未结 17 1993
长情又很酷
长情又很酷 2020-11-22 00:07

I would like to place a \"please wait, loading\" spinning circle animation on my site. How should I accomplish this using jQuery?

17条回答
  •  难免孤独
    2020-11-22 00:36

    This would make the buttons disappear, then an animation of "loading" would appear in their place and finally just display a success message.

    $(function(){
        $('#submit').click(function(){
            $('#submit').hide();
            $("#form .buttons").append('Loading...');
            $.post("sendmail.php",
                    {emailFrom: nameVal, subject: subjectVal, message: messageVal},
                    function(data){
                        jQuery("#form").slideUp("normal", function() {                 
                            $("#form").before('

    Success

    Your email was sent.

    '); }); } ); }); });

提交回复
热议问题