在收到当前响应后执行的重复请求文件test.php的循环中必不可少
Groups = {
'1': 1214,
'2': 1215,
'3': 1217,
'4': 1225,
'5': 1294,
'6': 1247
}
$.each(Groups, function (index, value) {
$.get('test.php', {
'call': value
}, function (result) {
$('.console_wrapper').append(result + '<br />');
});
// if the result obtained is performed again
// next
});
答案 0 :(得分:0)
尝试
Object.size = function (obj) {
var size = 0,
key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
var Groups = {
'1': 1214,
'2': 1215,
'3': 1217,
'4': 1225,
'5': 1294,
'6': 1247
}
var max = Object.size(Groups); //get size/length of Groups
i = 1;
function get_value(val) {
$.get('test.php', {
'call': val
}, function (result) {
$('.console_wrapper').append(result + '<br />');
if (i < max) { //if i is less than max
get_value(Groups[++i]); //call function with new value from Group
}
});
}
get_value(Groups[i]);