title: Post to Facebook wall/feed using AJAX/jQuery
body: <p>pulling my hair out over this one.</p>
  
  <p>I'm writing a Facebook-connected web app that will ultimately post some arbitrary information to the walls of friends that are selected throughout the process.</p>
  
  <p>I'm in the final stages now and was hoping that posting to the walls would be simple, but I've spent far too long trying to figure this out now so I'm hoping someone can help me.</p>
  
  <p>I'm trying to post using ajax like so:</p>
  
  <pre><code>$.ajax({
      type: 'POST',
      url: "https://graph.facebook.com/bbeckford/feed",
      data: {message: wallMessage, target_id: friendID, access_token: "&lt;?= $cookie['access_token'] ?&gt;", format: "json"},
      success: function(data) { alert(data); },
      dataType: "JSON"
  });
  </code></pre>
  
  <p>But I just keep getting this error: "XMLHttpRequest cannot load <a href="https://graph.facebook.com/bbeckford/feed" rel="nofollow">https://graph.facebook.com/bbeckford/feed</a>. Origin <a href="http://www.secretsantasetup.com" rel="nofollow">http://www.secretsantasetup.com</a> is not allowed by Access-Control-Allow-Origin."</p>
  
  <p>I've done searches and one suggestion is to make a php proxy, is that a viable option? How would I go about doing that?</p>
  
  <p>Am I approaching this completely wrong??</p>
  
  <p>Any help would be greatly appreciated,
  Thanks,
  -Ben</p>
  
  <p><strong>EDIT</strong>
  I want to do this in the background, ie user has selected 10 friends for example, then on submit the app will loop through each friend and post something on their wall. Is this possible?
  Thanks!</p>
  
  <p><strong>EDIT 2</strong>
  The test console at the bottom of the following page does exactly what I want to do, but there is no source code? - <a href="http://developers.facebook.com/docs/reference/rest/stream.publish" rel="nofollow">http://developers.facebook.com/docs/reference/rest/stream.publish</a></p>