0

I am trying to get access to a varible named has_photo inside function inside Vk.api.call but to no avail.

I have tried multiple things to make it work, like adding a return function or adding name to the function and then calling it.

My goal is to repeat the API call until user has a photo.

VK.Api.call('users.get', {
  user_ids: 99,
  fields: "has_photo",
  v: "5.73"
}, function (r) {
  has_photo = r.response[0].has_photo;
  return has_photo;
  }
);
AndrewL64
  • 15,794
  • 8
  • 47
  • 79
user1743703
  • 133
  • 2
  • 10
  • But what and where is has_photo (the variable) in relation to this code? – Jack Bashford Dec 15 '18 at 11:43
  • It says has_photo is not defined but when I define it it says undefined. Either way it doesnt hold the response from api outside of the function. – user1743703 Dec 15 '18 at 11:47
  • Here is where I fount the answer: https://stackoverflow.com/questions/6847697/how-to-return-value-from-an-asynchronous-callback-function – user1743703 Dec 15 '18 at 12:58

0 Answers0