显示加载内容/图像,同时等待 [英] Display loading content/image while waiting

查看:114
本文介绍了显示加载内容/图像,同时等待的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP页面,做一些后端处理。它调用存储过程,如果这个过程完成后,将返回一个状态值。整个处理时间可以持续围绕10-30秒,这取决于输入的数据量。

I have got an ASP page that does some back-end processing. It calls a stored procedure which will return a status value if the process is complete. The whole processing time can last around 10-30 seconds, depending on the amount of input data.

在这段时间里,我想这要好得多显示加载图像或文字不仅仅是一个空白页。至少在这样的用户知道了她的要求正在处理中,只需要等待它完成。

During this period of time, I guess it'd be much better to display a loading image or text than just a blank page. At least in this way the user knows the her request is being processed and just need to wait for it to finish.

我不知道我们如何与传统的ASP实现这一点。有任何想法吗?

I am not sure how we could implement this with classic ASP. Any ideas?

非常感谢。

编辑:

嗯,我想有什么东西我没有解释前面很清楚。这里的实际情况是:

Well I guess there's something I didnt explain very clearly earlier. The actual scenario here is:

我有2 ASP页面, A.asp B.asp 。用户点击一个A.asp按钮,将提交表单B.asp,和 B.asp 与处理页面,将调用后端存储过程。当B.asp与加工完成后,将用户重定向到另一个页面。

I have got 2 asp pages, A.asp and B.asp. User clicks a button on A.asp and it will submit form to B.asp, and B.asp is the processing page that will call the back-end stored procedure. When the B.asp is done with processing, it will redirect user to another page.

所以,我的问题是,每当用户点击A.asp的按钮,并得到B.asp,但只是一个空白页,即使我已经有了HTML code置于(显示加载图片) B.asp一开始(在asp code连接数据库的方式如下图)。我不知道为什么它时,它的加载不是显示图像。

So the problem I have is, whenever user clicks the button of A.asp and gets to B.asp, there's just a blank page, even though I already had HTML code (displaying a loading image) placed at the very beginning of B.asp (the asp code that connects the database is way below). I don't know why it's not displaying image when it's loaded.

推荐答案

当你说显示加载消息,您正在使用AJAX我间preT。在阿贾克斯开始您可以显示图像,并在阿贾克斯complete回调可以隐藏加载图像。请提供一些code例子如果可能的话。

When you say displaying loading message, I interpret that you're using ajax. In ajax start you can display that image, and in ajax complete callback you can hide the loading image. Please provide some code examples if possible.

在情况下,如果jQuery的AJAX,你可以使用:

In case if jQuery ajax, you can use:

$('#loaderImage').show();
$.ajax({
    // Other ajax parameters
    success: function () {
       // hiding the image here
       $('#loaderImage').hide();
    }
});

这篇关于显示加载内容/图像,同时等待的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆