加载在PHP,AJAX或javascript进展? [英] Loading progress in php, ajax or javascript?

查看:112
本文介绍了加载在PHP,AJAX或javascript进展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何一个知道我怎么能显示与完成%加载进度在我的客户端,而该系统仍然得到的数据在服务器端。

Any one know how can I display the loading progress with completed % on my client side while the system is still getting data in the server side.

例如,当我美元的客户边P $ PSS确定按钮,它会调用服务器端从数据库中收集数据,整个过程可能需要2至3分钟。我怎样才能显示在客户端的加载进度(有关如何装载仪的许多%已经完成)?

For example, when I press 'ok' button in the client side, it will call to server side to collect data from the database, the whole process may take 2 to 3 mins. How can I display the loading progress on the client side (about how many % of the loding have been done)?

如何才能做到这一点在PHP中,阿贾克斯或JavaScript?

How can I do it in php, ajax or javascript?

推荐答案

一旦你点击确定按钮,就可以开始获取数据的服务器端,并保持在会话中加载的百分比。

Once you click on the "Ok" button, you could start fetching data server-side and keep the percentage loaded in the session.

这样一来,客户端,你可以使通过AJAX请求到另一个PHP脚本返回加载的百分比。

That way, client-side you could make a request via AJAX to another php script returning the percentage loaded.

您会结束了2服务器端脚本(一个获取数据和其他获取的百分比)和一个Ajax请求的客户端。

You would end up with 2 server-side scripts (one to fetch the data and other to fetch the percentage) and one AJAX request client side.

我觉得这是一个简单的解决方案,应该这样做很好。

I think that's an easy solution and should do it fine.

这篇关于加载在PHP,AJAX或javascript进展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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