J
J
jackie chan2015-11-05 22:22:33
JavaScript
jackie chan, 2015-11-05 22:22:33

I get an error from VK why?

I want to get VK user data on my website as indicated in the users.get documentation

<script src="//vk.com/js/api/openapi.js" type="text/javascript"></script>
  <script>
    VK.init({
        apiId: 5135424
    });
  </script>
</head>

<body>
<script type="text/javascript">
  VK.init(function() {
    VK.api("users.get", "{user_ids : '1'}", function(data) {
      id = data['response']['0']['id'];
      first_name = data['response']['0']['first_name'];
      last_name = data['response']['0']['last_name'];
      alert(id);
    });	
  }, function() {
    alert('Ошибка при инициализации VK.API');
  }, '5.8');
</script>

as a result, in the console I see this Uncaught Error: VK.init() called without an apiId what the hell?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question