AJAX进度条 - 轮询,彗星? [英] AJAX Progress Bar - Polling, Comet?
问题描述
我想就如何实现以下一些建议:
I would like some advice on how to implement the following:
我想提出我的用户意识到这一点是通过AJAX我的服务器上运行的任务的进度。我的服务器运行的PHP脚本下载使用popen函数的通过shell命令的文件。它定期回声/打印正在发生的事情。我想使用AJAX和present给用户捕获该输出。
I would like to make my users aware of the progress of a task that is running on my server via AJAX. My server runs a PHP script that downloads a file via shell command using the popen function. It periodically echos/prints what is happening. I would like to capture this output using AJAX and present it to the user.
有人告诉我,在另外一个问题,我可能需要使用轮询或彗星的?我真的AP preciate如何在最简单,最有效的方式实现这一目标的任何帮助或指导。但愿,我仍然可以使用jQuery的。
I was told in another question that I might need to make use of polling or comet? I would really appreciate any help or guidance on how to achieve this in the simplest and most efficient way. Hopefully, I can still make use of JQuery.
感谢大家抽出时间来阅读此。
Thank you all for taking the time to read this.
P.S。我能走到这一步,非常感谢给计算器社区:)
推荐答案
这听起来像一个伟大的机会,的Ajax长轮询,这是一般彗星实现使用的是无数的技术之一。有堆栈溢出另一个问题的样品code。
This sounds like a great opportunity for Ajax long polling, which is one of the myriad techniques used in general Comet implementations. There's another question on Stack Overflow with sample code.
这篇关于AJAX进度条 - 轮询,彗星?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!