Answer the question
In order to leave comments, you need to log in
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
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> участников
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);
});
}
});
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 questionAsk a Question
731 491 924 answers to any question