【发布时间】:2015-09-09 15:32:36
【问题描述】:
这是我的代码:
$(document).ready(function(){
$("#pbo").hide();
$('.pie_progress').asPieProgress({
namespace: 'pie_progress',
size: 100,
barsize: '4'
});
$("#getit").click(function(){
$.post("process.php",
{
yurl: $("#yurl").val()
},
function(data,status){
if(data > 0 ) {
$('#yurl').hide();
$('#getit').hide();
$("#pbo").show();
$('h1').hide();
$('.pie_progress').asPieProgress('start');
$('.pie_progress').asPieProgress('go',data);
} else {
$('#yurl').show();
$('#getit').show();
$("#pbo").hide();
}
});
});
});
当我单击我的#getit 按钮时,它会执行process.php 并获取返回的数据,然后将其传递给$('.pie_progress').asPieProgress('go',data);。我的进度条会使用该数据进行更新,但这似乎只发生一次。有没有办法继续发出POST 请求,直到数据值为 100?
注意:在 process.php 中,我有一个 php exec,它每秒回显进度。
【问题讨论】:
标签: php ajax linux loops progress-bar