How to display a loading image until a gridview is fully loaded without Ajax Toolkit?

前端 未结 6 680
一个人的身影
一个人的身影 2021-01-03 06:10

QUESTION

Can anyone suggest how a loading image can be displayed until a gridview is fully loaded?

This gridview is to be rendered on page

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-03 06:28

    From your code :

    $(function() {
      $.ajax({
        type: "POST",
        url: "Default.aspx/UpdateGV",
        data: "{}",
        contentType: "application/json",
        dataType: "json",
        success: function() {
          // Run return method.
        },
        // add these lines
        beforeSend:function {
           //this will show your image loader
           $("$Loader").css("display","block");
        },
        complete:function {
           //this will hide your image loader provided that you give an id named Loader to your image
           $("$Loader").css("display","none");
        }
      });
    });
    

提交回复
热议问题