1
1
15x032432019-01-02 15:42:04
JavaScript
15x03243, 2019-01-02 15:42:04

Can't work with VK Open API?

Good day!
The other day I installed VK Open Api, but when I called the method showGroupSettingsBox, I got the following error:

Uncaught TypeError: VK.callMethod is not a function at vk.php:15

vk.php code:
<html>
     <head>
<script src="https://vk.com/js/api/openapi.js?160" type="text/javascript"></script>

<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
    VK.init({
        apiId: 1234567
    });
});
     </script>
</head>
         <body>
              <script type="text/javascript">
                   //Ошибка на следующей строчке.
                   VK.callMethod("showGroupSettingsBox", 4096);
              </script>
         </body>
    </html>

Hope for help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-01-02
@KenKup

Most likely, the error occurs due to the fact that your method VK.init()will be called only when the entire page is loaded, and VK.callMethod, apparently, is called earlier

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question