Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function add(){
  2.     $("#vk_groups").html('');
  3.     $(".wall").show();
  4. }
  5.  
  6. function check(){
  7.     var id, isMember;
  8.     VK.api('users.get', function(data){
  9.         id = data.response[0].id;
  10.     });
  11.    
  12.     VK.api('groups.isMember', {group_id:'77739720', user_id: id}, function (data){
  13.         if(data.response === 1){
  14.             VK.api('wall.getReposts', {owner_id:'-77739720', post_id:'16'}, function(repost){
  15.             var x = md5(id);
  16.             for(var i=0; i<repost.response.profiles.length; i++){
  17.                 if(id == repost.response.profiles[i].id){
  18.                     $.ajax({
  19.                         type: 'POST',
  20.                         url: 'insert',
  21.                         data: {user_id:id, x:x},
  22.                         success: function(data){
  23.                             $(".lbl").html('Поздравляем!');
  24.                             $(".info").show();
  25.                             $(".group").html('');
  26.                         }
  27.                     });
  28.                 }
  29.                 else{
  30.                     console.log('babah');
  31.                 }
  32.  
  33.  
  34.             }
  35.         });
  36.         }
  37.        
  38.     });
  39.  
  40. }
  41.  
  42. function update(){
  43.     var id,
  44.         nick = $("#nick").val();
  45.     VK.api('users.get', function(data){
  46.         id = data.response[0].id;
  47.     });
  48.        
  49.     $.ajax({
  50.        type: 'post',
  51.        url: 'update',
  52.        data: {nick:nick, id_x: md5(id)},
  53.        success: function(data){
  54.            
  55.        }
  56.     });
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement