执行WebMethod时显示忙碌图像 [英] Show Busy image When a WebMethod is Executes

查看:109
本文介绍了执行WebMethod时显示忙碌图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在执行一项任务,其中我已使用WebMethod和Json来从数据库中插入和检索数据,

现在,无论何时调用WebMethod,我都希望在DIV中显示gif图像.

我的js代码是这样的:

Hi,

I am working on a task where I have used WebMethod using Json to insert and retrieve data from data base,

Now I want a gif image shows in a DIV whenever a WebMethod is called.

My js code is like this:

function getvalues(j, selectedTab) {
 $("#DVloading").show();
    $.ajax({
        type: "POST",
        url: "xxx.aspx/LoadData",
        data: "{''id'':''" + j + "'',''selectedTab'':''" + selectedTab + "''}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            if (msg.d.length > 0) {
                var dv = document.getElementById("xxxDiv");
                dv.innerHTML += msg.d;
            }
        },
        async: false,
        error: function(xhr, status, error) {
            //alert(xhr.statusText);
        }
    });
 $("#").hide();
} 


我有这样的页面正文:


I have the page body like this:

<body>
    <form id="form1"  runat="server">
    <div>
        <div id="DVloading" style="display:none;">
          <img src="../Images/circular.gif" width="20" height="23" />
        </div>
        <div id="xxxDiv">
        </div> 
    </form>
</body></div>


但是在这里,每当调用WebMethod时,整个页面就会被挂起10秒钟(从DB中获取数据的时间),却没有任何反应.而当它加载所有数据后便释放了被绞死的信息.图片未显示在那里.

任何帮助是极大的赞赏.

问候,

Tanweer,


But Here whenever the WebMethod is called the whole page is hanged for 10 second(the time to fetch data from DB) and nothing does. and when it loads all data then released the hanged. Image is not showing there.

Any help is greatly appreciated.

regards,

Tanweer,

推荐答案

(#DVloading").show();
("#DVloading").show();


.ajax({ 输入:"POST", 网址:"xxx.aspx/LoadData", 数据:"{" id:""+ j +"'',"selectedTab":" + selectedTab +''}", contentType:"application/json; charset = utf-8", dataType:"json", 成功:function(msg){ 如果(msg.d.length> 0){ var dv = document.getElementById("xxxDiv"); dv.innerHTML + = msg.d; } }, 异步:错误, 错误:功能(xhr,状态,错误){ //alert(xhr.statusText); } });
.ajax({ type: "POST", url: "xxx.aspx/LoadData", data: "{''id'':''" + j + "'',''selectedTab'':''" + selectedTab + "''}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { if (msg.d.length > 0) { var dv = document.getElementById("xxxDiv"); dv.innerHTML += msg.d; } }, async: false, error: function(xhr, status, error) { //alert(xhr.statusText); } });


(#").hide(); }
("#").hide(); }


我有这样的页面正文:


I have the page body like this:

<body>
    <form id="form1"  runat="server">
    <div>
        <div id="DVloading" style="display:none;">
          <img src="../Images/circular.gif" width="20" height="23" />
        </div>
        <div id="xxxDiv">
        </div> 
    </form>
</body></div>


但是在这里,每当调用WebMethod时,整个页面就会被挂起10秒钟(从DB中获取数据的时间),却没有任何反应.而当它加载所有数据后便释放了被绞死的信息.图片未显示在那里.

任何帮助是极大的赞赏.

问候,

Tanweer,


But Here whenever the WebMethod is called the whole page is hanged for 10 second(the time to fetch data from DB) and nothing does. and when it loads all data then released the hanged. Image is not showing there.

Any help is greatly appreciated.

regards,

Tanweer,


这篇关于执行WebMethod时显示忙碌图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆