如何仅针对特定请求显示ajax加载gif?
如何仅针对特定请求显示ajax gif? 例如,我的页面每 30 秒在后台调用一次 Web 服务,并且我不想在此回调期间显示 gif。另一方面,当我发出手动 ajax 请求时,我想显示 gif。
我正在使用 jQuery。
编辑:我没有设置全局处理程序,如下所示 http://api.jquery.com /ajaxStart/,只需附加到 .ajaxStart 事件即可。但我也不想在每次请求时手动显示/隐藏 gif。我需要一些通用的解决方案。
How do you show ajax gif only for a specific request?
For example my page is calling a web-service every 30 seconds in a background, and I don't want to show the gif during this callback. On the other hand I want to show the gif, when I'am making manual ajax requests.
I am using jQuery.
edit: I didn't setup the global handler as shown here http://api.jquery.com/ajaxStart/, just by attaching to the .ajaxStart event. But I don't want to show/hide the gif manually on every request too. I need some generic solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
就这样吗?
Like that?
请尝试这个:
HTH
Please try this:
HTH
我使用 BlockUI 插件,确实非常简单。这是我为一些演示代码编写的一个简单的包装函数:
}
I use the BlockUI plugin, makes it pretty easy really. This is a simple wrapper function I wrote for some demo code:
}