Eric Wong
Eric Wong

Reputation: 81

How to handle the response returned from the facebook apprequest function?

function sendRequestToManyRecipients() {
        FB.ui({method: 'apprequests',
          message: 'My Great Request',
        }, requestCallback);
      }

      function requestCallback(response) {

      }

apparently its supposed to return something like this

{
  “request_ids”: [
    0: [request_id]
    1: [request_id]
    ...
  ]
}

i need to get the ids from the response and execute another function using the ids how can i do that? thanks in advance

Upvotes: 1

Views: 2895

Answers (1)

Tinggo
Tinggo

Reputation: 1137

I guess you means ids is the id of recipient ids, so the easiest way is

  1. Enable "Request 2.0 Efficient" you can enable it in your application setup page (advance tab)

  2. Use the following:

    function requestCallback(response) 
    {
        var ids = response["to"];
        for (var i = 0; i < ids.length; ++i)
        {
            //"ids[i]" is what you want.              
        }
    }
    

Upvotes: 1

Related Questions