FB.api friend invite
===

Im having a problem.

Im trying to make a invite friends facebook app..

The code is working on another site and i cant get it to work.

it would be amazing if some of you guys could help me...

This is the code:


    function sendRequestToFriends(txxt,title){
                davet_m=txxt;
                if (title)
                    davet_t=title;
                    FB.login(function(response) {
                        if (response.authResponse) {
                               if(!kkk) {
                                   kkk=1;
                                   //$.post("/justhtml/181411457193/email",{"token":response.authResponse.accessToken},function(data) {});
                               }
                            all();
                        }
                        else {
                            all();
                        }
                    }, {scope: 'email'});
            }
                    function all(){
                            var friends = new Array();
                            FB.api('/me/friends', function(response) {
                               for (var i=0; i<response.data.length; i++) {
                                  friends[i] = response.data[i].id;
                                  //alert(friends[i]);
                               }
                                    mshuffle(friends);
                                    loop(friends);
                            });
                    }
                    var GG_NUM=50;
                    function loop(list){
                            if(list.length != 0){
                                    //alert(list.length);
                                    var string = '';
                                    var shifting = 0;
     
                                    if (list.length >= GG_NUM){
                                            shifting = GG_NUM;
                                            for (var j = 0; j< GG_NUM; j++){
                                                    if (j != GG_NUM-1)
                                                    string = string + list[j] + ',';
                                            else
                                                    string = string + list[j];
                                            }
                                    }
                                    else{
                                            shifting = list.length;
                                            for (var j = 0; j< list.length; j++){
                                                    if (j != list.length - 1)
                                                    string = string + list[j] + ',';
                                            else
                                                    string = string + list[j];
                                            }
                                    }
                                    string = "'" + string + "'";
                                    FB.ui({method: 'apprequests', data: '413601382008556', message: davet_m, title: davet_t, to : string},
                                    function(response) {
                                                 if (response) {
                                                            for (var i = 0; i < shifting; i++){
                                                                    list.shift();
                                                            }
                                                            loop(list);
                                                 }
                                                 else{
                                                 
     
                                                 }
                                    });
                       } else {
                                       top.location.href = 'https://lolpup.worlditsme.com/testy.php/';
                       
                        }
                    }