如何在 ajax 操作期间显示 throbber 或其他指示器?
I would like to know how to show an ajax loader gif while the "remote" function is busy with backend procedures.
If possible, could you please look at the milk example and tell me how it would fit into that code. Simply click on "Show script used on this page" to view the source.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设您已经知道如何使用 AJAX。基本过程是,在操作开始时显示图像,最后当从服务器返回结果时隐藏它。
-
请参阅:
编辑: remote 方法像 ajax 请求一样接受对象文字。所以插入这个:
Assuming you already know how to AJAX. The basic procedure is that at the beginning of the operation you show an image, and at the end when you get results back from the server you hide it.
-
See:
Edit: The remote method accepts an object literal like the ajax request does. So plug this in:
对于您的 AJAX 调用:
然后,在您的实际 AJAX 请求中:
最后,AJAX 调用后的函数:
For your AJAX call:
Then, in your actual AJAX request:
Finally, your functions for after the AJAX call:
我从您创建的页面中获取了此内容。为了简单起见,我将其全部作为 js,但您可以使用 html 创建元素并应用样式表中的样式。
I took this from the page you created. For simplistic sake I put it all as js but you can create the element with html and apply the styles in the style sheet.