V
V
Victor Grom2016-04-22 21:19:03
JavaScript
Victor Grom, 2016-04-22 21:19:03

Display the number of subscribers of the VK page?

Hello.
It is necessary to display the number of subscribers of the personal VK page to the site (to text, html).

I know how to display the number of subscribers in a group (found on the Internet).
Here:

<script>
    jQuery(function($){
        $.ajax({  
            url: 'http://api.vk.com/method/groups.getById?gid=65762432&fields=members_count', // вместо 65762432 указываем свой ID 
            dataType: "jsonp", // тип получаемых данных
            success:function(e){ 
                $('#vkontakte_count').html(e.response[0].members_count) // выводим получаемый результат
            }  
        }); 
    });
</script>

<!-- здесь будет отображаться количество подписчиков -->
<span id="vkontakte_count"></span>

I use the same structure for my personal page, but nothing is displayed ((
Here is the code:
<script>
    jQuery(function($){
        $.ajax({  
            url: 'http://api.vk.com/method/users.getFollowers?uid=286951361&count', 
            dataType: "jsonp", 
            success:function(e){ 
                $('#vkontakte_count').html(e.response[0].count) 
            }  
        }); 
    });
</script>

<!-- здесь будет отображаться количество подписчиков -->
Kolichestvo podpischikov <span id="vkontakte_count"></span>

================================================= =================
The API request is correct api.vk.com/method/users.getFollowers?uid=286951361...
because it shows the number, but I can’t pull out the number . I assume that the error is somewhere here
$('#vkontakte_counte').html(e.response[0].count)
Help, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-04-22
@Vitaliziti

$('#vkontakte_counte').html(e.response.count)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question