0
请问如何在AJAX请求后更新进度条?以下是我迄今所做的:AJAX请求后更新进度条
$("#progressbar").progressbar({ max: queue.length});
什么是下一个步骤:
function test(){
var queue = ["a","b","c","d","e"];
$("#dialog").dialog("open");
$("#progressbar").progressbar({ max: queue.length});
var execute_queue = function(index)
{
$.ajax({
url: queue[index],
dataType: 'json',
success: function(json){
if (json['error']) {
console.log(json['error']);
}
if (json.response) {
console.log(json['response']);
}
index++; // going to next queue entry
// check if it exists
if (queue[index] != undefined)
{
execute_queue(index);
}
}
}); // end of $.ajax({...
}; // end of execute_queue() {...
var index = 0;
execute_queue(index); // go!
}
首先我用数队列阵列设置进度条的最大长度?如果我没有错,下一步是绕过index ++命令。