gpt4 book ai didi

jquery 动态更改 css 在 chrome 中不刷新

转载 作者:太空宇宙 更新时间:2023-11-03 19:01:35 25 4
gpt4 key购买 nike

在下面的代码中,我试图在 ajax 请求之前显示 div,在完成之后我想隐藏 div。hide() 工作正常但 show() 不工作。它在 Firefox 中运行良好。

$("#btnpst").click(function () {
$('#dvloading').show();
$.ajax({
url: url,
type: "POST",
async: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data, st) {
if (st == "success") {
$('#dvloading').hide();
}
},
error: function () {
$('#dvloading').hide();
}
});
} //<
});

HTML

<div id="dvloading" style="width: 480px; height: 320px; position: absolute; overflow: hidden;">
<image src="../loading_2.gif" style="margin-top: 120px;">
</div>

最佳答案

我认为您正在本地测试并且响应非常快。为什么不改变这一行

$('#dvloading').hide();

对此

setTimeout(function(){$('#dvloading').hide();},5000);

看看是不是这样。此外,从 javascript 控制台检查是否没有与 js 相关的错误也很有帮助

关于jquery 动态更改 css 在 chrome 中不刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11896001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com