Show “loading” animation on button click

前端 未结 6 949
感情败类
感情败类 2021-01-30 14:10

I want to do something very simple. I have one button in my page.

6条回答
  •  无人共我
    2021-01-30 14:29

    $("#btnId").click(function(e){
          e.preventDefault();
          $.ajax({
            ...
            beforeSend : function(xhr, opts){
                //show loading gif
            },
            success: function(){
    
            },
            complete : function() {
               //remove loading gif
            }
        });
    });
    

提交回复
热议问题