【问题标题】:loading overlay while ajax call in jsp page [closed]在jsp页面中调用ajax时加载覆盖[关闭]
【发布时间】:2011-06-04 17:35:05
【问题描述】:

您好,当我执行 ajax 调用以加载我的下拉列表时,我想在 jsp @ center of page 添加一个效果。

【问题讨论】:

    标签: java jquery ajax json jsp


    【解决方案1】:

    不看代码就很难回答你的问题。但是有很多方法可以在 javascript 中生成“加载”掩码。这取决于您拥有哪些 javascript 库。我将举一个 Ext.LoadMask 的例子:

    // First param of LoadMask constructor is the element to display the load mask over.
    myMask = new Ext.LoadMask(Ext.getBody(), {
        msg:"Please wait..."
    });
    
    myMask.show();
    // Perform ajax call to load data ... something like
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                // Your code populates the dropdown with the response ...
                // Then hide the mask when data is loaded
                myMask.hide();
        }
    }
    xmlhttp.open("GET","http://myurl/data",true);
    xmlhttp.send();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-19
      • 1970-01-01
      • 1970-01-01
      • 2014-02-26
      • 2021-01-27
      相关资源
      最近更新 更多