V
V
Vanes Ri_Lax2016-03-30 12:46:27
JavaScript
Vanes Ri_Lax, 2016-03-30 12:46:27

How to count the number of comments in the vk widget?

Hello,
I have a news site, when viewing an article, a VK widget with comments is loaded. Announcements of these news are displayed on the main page, is it possible to make the number of comments displayed in these announcements?
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aleksandr, 2016-03-30
@vanesxl

poke
again

<div id="vk_count"></div>
<script type="text/javascript">
VK.Api.call('widgets.getComments', 
{widget_api_id: "1234567", url: document.URL}, 
function(obj) {
document.getElementById('vk_count').innerHTML = 'всего:' + obj.response.count;
});
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question