E
E
EvgenyMorozov2015-08-03 17:15:06
Classmates
EvgenyMorozov, 2015-08-03 17:15:06

How to get the number of group members in Odnoklassniki in json?

Good afternoon
Tell me how to get the number of members of a certain group in Odnoklassniki using jquery (only the number is needed)? I did it for all other social networks, but it doesn’t work for OK.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vjacheslav Kanivetc, 2015-08-04
@EvgenyMorozov

https://apiok.ru/wiki/display/api/group.getInfo

A
Astylle, 2017-01-23
@Astylle

Where is the error in output? How to display the result correctly?

<script>
    jQuery(function($){
      $.ajax({  
      url: 'https://api.ok.ru/fb.do?application_key=APP_KEY&fields=members_count&format=json&method=group.getInfo&uids=IDгруппы&sig=SIG',
      dataType: "jsonp",
      success:function(e){ 
        $('#OK').html(e.response[0].members_count)
      }  
      }); 
    });
    </script>
    <span id="OK"></span> участников

E
EvgenyMorozov, 2017-01-23
@EvgenyMorozov

It works for me like this

$.ajax({
      type: "GET",
      dataType: "xml",
      cache: true,
      ifModified: true,
      url: "https://api.ok.ru/fb.do?application_key=XXXXXXXXXXXXXXXXXXXXXX&method=group.getInfo&uids=XXXXXXXXXXXXXXXXXXXXX&fields=members_count&sig=XXXXXXXXXXXXXXXXXXXXXXXXX",
      success: function(xml) {
        $(xml).find('members_count').each(function(){
          var name = $(this).text();
          $("#ok_count").html(name);
        });
      }
    });

H
Hubix, 2017-07-21
@Hubix

My version

<span id="ok_count"></span > участников
<script>
    jQuery(function($){
      $.ajax({  
      url: 'https://api.ok.ru/fb.do?application_key=XXXXXXXXXXXXXXXXXXXXXXXXX&fields=members_count&format=json&method=group.getInfo&move_to_top=false&uids=XXXXXXXXXXXXXXXXXXXXXXXXX&sig=XXXXXXXXXXXXXXXXXXXXXXXXX&access_token=XXXXXXXXXXXXXXXXXXXXXXXXX',
      dataType: 'json',
      success:function(data){
        $('#ok_count').html(data[0].members_count)
      }  
      }); 
    });
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question