title: Facebook: Posting to Multiple Friend's Walls Using Multiple Friend Selector and JS SDK
body: <p>I have tried putting together some code based on some other SO questions and various web tutorials.</p>
  
  <p>The error I am getting is right at the end when I try and post to my friend's walls.</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt;
  
  &lt;p&gt;&lt;input type="button" onclick="sendRequestViaMultiFriendSelector(); return false;" value="Recommend friends for another chance to win!" /&gt;&lt;/p&gt;
  
  &lt;div id="response"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  FB.init({
      appId  : 'xxxxxxxxxx',
      status : true,
      cookie : true,
      oauth: true
  });
  
  function sendRequestViaMultiFriendSelector() {
      FB.ui({method: 'apprequests',
          message: 'My Great Request'
      }, requestCallback);
  }
  
  function requestCallback(response) {
      // Handle callback here
      if (response.request &amp;&amp; response.to) {
          var request_ids = [];
          for(i=0; i&lt;response.to.length; i++) {
              var temp = response.request + '_' + response.to[i];
              var friend_id = response.to[i];
              request_ids.push(temp);
  
              //send message in here
              var opts = {
                  message : 'Message',
                  name : 'Name',
                  link : 'http://www.facebook.com/pages/xxxxx/xxxxxxxxxxxxxxx',
                  description : 'Description here',
                  picture : 'http://www.example.com/img/some.jpg'
              };
  
              FB.api('/'+friend_id+'/feed', 'post', opts, function(response) {
                  if (!response || response.error) {
                      // This is the error I am getting:
                      alert('Error occured');
                  } else {
                      alert('Post ID: ' + response.id);
                  }
              });
              // end send message 
          }
          var requests = request_ids.join(',');       
      } else {
          alert('Didn't send recommendation to friends');
      }
  }
  &lt;/script&gt;
  </code></pre>