最简单的方式,提供与QUOT;在进度和QUOT; ..."完成"通知? [英] Simplest way to provide "In progress"..."Done" notification?
问题描述
我没有新的节目,但那种生锈在Javascript / Web开发。我建立使用Rails应用程序,我们必须在此期间,我们要提供反馈给用户一些耗时的操作。基本上,我想要做的事该使用AJAX这样的:
- [用户单击确定或继续]
- [可选确认框]
- 在显示状态消息,说工作......,而操作发生
- 当操作完成并返回数据从服务器,状态消息更改为完成!其结果呈现或一些回调发生。
这已经有一段时间,因为我做了网络的发展,以及如何实现这样的一个简单的例子是非常有益的。谢谢你。
$(窗口).ajaxStart(函数(){
$(#装载机)显示()。
})。ajaxStop(函数(){
$(#装载机)隐藏()。
});
只是全球绑定到启动和停止。这个例子显示和隐藏装载机股利。通常你有它让用户微调一个div知道它加载。
微调的消失应该够了,完成的消息,是矫枉过正。
I am not new to programming, but kind of rusty in Javascript/web development. I am building an application with Rails, and we have several time-consuming operations during which we want to provide feedback to the user. Basically, I want to do something like this using AJAX:
- [User clicks 'ok' or 'proceed']
- [Optional confirmation box]
- Show a status message saying "Working..." while the operation takes place
- When the operation finishes and data returns from the server, status message changes to "Done!" and the results are rendered or some callback occurs.
It has been a while since I did web development, and a simple example of how to achieve something like this would be very helpful. Thank you.
$(window).ajaxStart(function() {
$("#loader").show();
}).ajaxStop(function() {
$("#loader").hide();
});
Just globally bind to start and stop. This example shows and hides a loader div. Generally you have a div with a spinner in it letting the user know that it is loading.
The disappearance of the spinner should be enough, a "done" message is overkill.
这篇关于最简单的方式,提供与QUOT;在进度和QUOT; ..."完成"通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!