How to get involved in a photo like VKontakte and find out how someone likes this photo?
I created the application and there is a “Like” button (or another option, I’ll post just a photo of VKontakte) and I’m sure that my server would immediately know that the photos were like.
You can get likes https://vk.com/dev/likes.getList , but I would like to update themselves like vkontakte.

<script type="text/javascript" src="openapi.js"></script> <div id="vk_like"></div> <script type="text/javascript"> VK.init({apiId: 5309489}); VK.Widgets.Like("vk_like", {type: "button"},55); VK.Observer.subscribe("widgets.like.liked", function f() { alert ("Thank you for your like."); }); </script> //этот код не работает в режиме реального времени 

How to do this?

  • What does "update yourself" mean? - Alexey Shimansky
  • What would change were immediately visible. Now I have found vk.com/dev/openapi_observer , but I can’t use an example where there are many I like buttons - Rakzin Roman

1 answer 1

Understood. Just place this code directly there. where a person clicks. And I tried to place on another page and get data there. when the user clicked.

 VK.Observer.subscribe("widgets.like.liked", function f() { //Здесь отправляем данные на свой сервер }); 
  • one
    Carefully with this solution, for likes from other places will not work, and the user will be able to send data without likes if he wants - andreymal
  • ok. Well, this is the only option that I came up with - Rakzin Roman