Answer the question
In order to leave comments, you need to log in
Why does the VK.api groups.getMembers function not always work?
Here is a function for getting members of the Vkontakte group. Sometimes it doesn't work and gives an error: response.users' is null or not an object
function loadUsersGroup(grOffset, grId, clear) {
VK.init(function() {
// выполняем запрос получения списка друзей
VK.api("groups.getMembers", {group_id: grId, fields: "photo_100, photo_200", count: 9, offset: grOffset},
function(data) {
if (clear == 1) {
$("#online").html('');
$('#loader').fadeIn(1);
}
//alert(grOffset + ' ' + grId + ' ' + clear);
scrollMode = 2;
idGroup = grId;
startGroup = grOffset;
var grCount = 0;
var photoURL;
grCount = data.response.users.length;
var usersGroupHtml = [];
//alert(grCount);
for (var i=0; i<grCount; i++) {
//j = i + 1;
if(!!data.response.users[i].photo_200)
photoURL = data.response.users[i].photo_200;
else
photoURL = data.response.users[i].photo_100;
//alert(photoURL);
usersGroupHtml[i] = '<div class="photoBlock frame view view-first" style="background:url(' + photoURL + ');' + backgroundSize +'"><div class="mask"><h2>' + data.response.users[i].first_name + ' ' + data.response.users[i].last_name + '</h2></div></div>';
$("#online").append(usersGroupHtml[i]);
}
$('#loader').fadeOut(1000);
});
});
}
Answer the question
In order to leave comments, you need to log in
Hmm... where does data.response.users come from, if it should be data.items???
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question