title: Create an Facebook event using JQuery and the graph api programmatically
body: <p>Is there a way to using a JQuery function to programmatically create an event to a users Facebook page? I have created an app that asks the user for the create_event permissions through:</p>
  
  <pre><code>&lt;input type="button" value="Add to Facebook" onclick="document.location='http://www.facebook.com/dialog/oauth?client_id=&lt;AppID&gt;&amp;redirect_uri=&lt;redirecturi&gt;&amp;scope=create_event,offline_access,manage_pages&amp;response_type=token'"&gt;
  </code></pre>
  
  <p>Which returns correctly to the redirect page with the parameters access_token and expires_in. The page uses the following code to parse out the data (less elegant, but I'm just trying to get this to work as a test)</p>
  
  <pre><code>&lt;script&gt;
  
  $(document).ready(function(){
      var url = window.location.href;
      var fbParameters = url.substring(url.indexOf('#')+1,url.length);
      var accesstoken;    
  
      if(fbParameters.indexOf("access_token=")&gt;=0){
          accesstoken = fbParameters.substring(fbParameters.indexOf("access_token=")+("access_token=").length,fbParameters.length);
          accesstoken=accesstoken.substring(0,accesstoken.indexOf('&amp;'));
          console.log(accesstoken);
      }
  
      var params = {'access_token':accesstoken,'name':'test','location':'someplace','start_time':'1322719200'}
  
      $.getJSON('https://graph.facebook.com/me/events?callback=?',params,function(data){console.log(data)});
  
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I have also tried using the JQuery $.post and also manually entered in the URL to attempt to create this test event. This returns:</p>
  
  <pre><code>XMLHttpRequest cannot load https://graph.facebook.com/me/events?. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>I have also tried modifying the URL to /User ID/events instead of /me/events. Facebook keeps returning:</p>
  
  <pre><code>({
      "data": [
  
      ]
  });
  </code></pre>
  
  <p>If I remove "events" from the URL, it accesses the user information as expected. Does anyone know if what I'm trying to do it actually possible? I feel like I am missing something obvious.</p>