开发者

Bringing process status to web?

开发者 https://www.devze.com 2023-03-05 17:09 出处:网络
i have a script which output the percentage of completeness : 10% 20%...100% done. Can i bring that output to the 开发者_运维知识库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

精彩评论

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

关注公众号