PHP
...
// disable caching
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header('Expires: Mon, 26 Jul 1991 05:00:00 GMT'); // disable IE caching
header('Content-Type: text/plain; charset=utf-8');
echo progressbar_value;
exit();
...
JS
var refresh_period = 1000; // ms
var script_path = '/script.php';
function updateProgressBar() {
$.ajax({url: script_path, success: function (value) {
$('#progressbar').progressbar(value);
if (data.value == 100) {
clearInterval(interval);
}
}
}
var interval = setInterval('updateProgressBar()', refresh_period);
来源
2010-12-06 13:42:48
r92
我怎么能这样做?我对客户端开发不熟悉! – 2010-12-06 13:02:30
使用jQuery的.ajax()方法。 – DampeS8N 2010-12-06 13:04:04