开发者

Bringing process status to web?

i have a script which output the percentage of completeness : 10% 20%...100% done.

Can i bring that output to the 开发者_运维知识库web? I call it using jquery ajax:

$.post('dojob.php?id=jobid');

thanks Arman


If I'm understanding what you want, you're looking to call dojob.php and have it return it's progress at certain intervals. This can't be done with one ajax call.

If you need to do this, you will have to call dojob.php but then every x seconds make a separate call to somehow monitor it's progress. For instance, lets say you have checkStatus.php which can give you the progress of dojob. So you call dojob.php, then every 5 seconds call checkStatus.php which will return your % complete of dojob.

Simiarly, you could call dojob and have it kick off a separate thread and then return. THen every x seconds call checkStatus.php, which will either return the % complete, or upon completion return the result of dojob.


to simply write it, try the following code

html:

<div id="progress"></div>

js code:

$('#progress').load('dojob.php?id=jobid');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜