gpt4 book ai didi

jquery - 使用 AJAX 加载时显示正在加载的 GIF 图像

转载 作者:行者123 更新时间:2023-12-01 07:24:00 25 4
gpt4 key购买 nike

   $.ajax({
url: "/image/productImages.jpg",
timeout:5000,

beforeSend: function(){
// Handle the beforeSend event
$('##loading').show();
},

complete: function(){
// Handle the complete event
$('##loading').hide();
},

success: function (data) {
alert("image was added successfully");
},

error: function () {
alert("There was an error. Image could not be added, please try again");
}
});

我想在图像加载时显示显示加载 gif,然后在图像加载后将其删除。这里我有这段代码来做到这一点,但是,这会直接出错。有谁知道为什么或如何解决这个问题。提前致谢!

最佳答案

您的 id 选择器有两个哈希值,

试试这个:

 $('#loading').show();

关于jquery - 使用 AJAX 加载时显示正在加载的 GIF 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10822038/

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