加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ajax提交后台开始到返回之间显示等待提示

发布时间:2020-12-16 02:11:50 所属栏目:百科 来源:网络整理
导读:pre 此功能完全是jandy所实现的,这里是总结以便以后遇到类似的功能时有例子参考!在这里非常非常感谢jandy! 1、用到的js function topLoading() { if(document.getElementByIdx_x("topLoadingDiv")==null ||document.getElementByIdx_x("topLoadingDiv")==
<pre>

此功能完全是jandy所实现的,这里是总结以便以后遇到类似的功能时有例子参考!在这里非常非常感谢jandy!
1、用到的js
function topLoading() {
if(document.getElementByIdx_x("topLoadingDiv")==null ||document.getElementByIdx_x("topLoadingDiv")==undefined) {
document.write("<div id='topLoadingDiv'class='top_loading'><img border='0'src='../images/loading.gif'/></div>");
}
document.getElementByIdx_x("topLoadingDiv").className="top_loading";
document.getElementByIdx_x("topLoadingDiv").style.left=(document.documentElement.clientWidth-32)/2+"px";
document.getElementByIdx_x("topLoadingDiv").style.top=(document.documentElement.clientHeight-32)/2+"px";
}

function topLoaded() {
if(document.getElementByIdx_x("topLoadingDiv")!='null'&&document.getElementByIdx_x("topLoadingDiv")!=undefined) {
document.getElementByIdx_x("topLoadingDiv").className="top_loaded";
}
}

2、用到的css
div.top_loading{background:url('../images/loading.gif')no-repeat;width:32px;height:32px;top:100px;left:100px;background-color:transparent;position:fixed;z-index:10000;}
div.top_loaded{width:1px;height:1px;background-color:transparent;display:none;}

3、用到的html

// 调用ajax之前
topLoading();
$.getJSON(url,null,function(data) {
obj.disabled=false;
if (data == "error") {
alert(opeContent+"失败!");
} else if (data == "succ"){
// 2、根据返回结果(成功或者失败),重写load该流程对应的所有组件
alert(opeContent+"成功!");
reloadListDetail(obj);
} else {
alert(data);
reloadListDetail(obj);
}
// ajax返回之后
topLoaded();
});

4、用到的图片:随便从网上下一个你所喜欢的即可。

</pre>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读