Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6003979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:11:52+00:00 2026-05-23T01:11:52+00:00

Is there a way to using a JQuery function to programmatically create an event

  • 0

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:

<input type="button" value="Add to Facebook" onclick="document.location='http://www.facebook.com/dialog/oauth?client_id=<AppID>&redirect_uri=<redirecturi>&scope=create_event,offline_access,manage_pages&response_type=token'">

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)

<script>

$(document).ready(function(){
    var url = window.location.href;
    var fbParameters = url.substring(url.indexOf('#')+1,url.length);
    var accesstoken;    

    if(fbParameters.indexOf("access_token=")>=0){
        accesstoken = fbParameters.substring(fbParameters.indexOf("access_token=")+("access_token=").length,fbParameters.length);
        accesstoken=accesstoken.substring(0,accesstoken.indexOf('&'));
        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)});

});

</script>

I have also tried using the JQuery $.post and also manually entered in the URL to attempt to create this test event. This returns:

XMLHttpRequest cannot load https://graph.facebook.com/me/events?. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.

I have also tried modifying the URL to /User ID/events instead of /me/events. Facebook keeps returning:

({
    "data": [

    ]
});

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:11:53+00:00Added an answer on May 23, 2026 at 1:11 am

    Calling the Graph API REST functions doesn’t really work well with pure JQuery because of the same origin policy (http://en.wikipedia.org/wiki/Same_origin_policy).

    It’s a better idea to use the JavaScript SDK which Facebook provide, it creates a hidden iframe to execute tasks on the facebook domain and passes the events back to your page quite nicely dealing with all of the authentication and event passing issues for you.

    You can find code samples, documentation and snippets on the facebook developer website (http://developers.facebook.com/docs/reference/javascript/) and here (http://developers.facebook.com/tools/console/)

    For example creating an event looks like:

    var event = {  
        name: 'Name of your event', 
        description: 'Description of your event',
        location: 'Location of event',                        
        start_time: Math.round(new Date().getTime()/1000.0), // Example Start Date
        end_time: Math.round(new Date().getTime()/1000.0)+86400 // Example End Date
    };
    
    FB.api('/me/events', 'post', event, function (result) {
        console.log(result); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery, is there a way to select all tag that reference a specific
I know you can do it for jQuery using jQuery.noConflict. Is there a way
I have a simple question. Is there a way ( using reflections I suppose
Is there a way using the iPhone SDK to get WiFi information? Things like
In .net, is there a way using reflection to determine if a parameter on
Is there a way (preferrably using JavaScript) to determine whether a URL is to
Is there any way of using Memcached for fragment caching in Rails?
Is there a straightforward way using reflection to get at the parameter list for
Is there a way of using ASP.NET user-controls (.ascx files) to fill my own
Does anybody know if there is a way using java to pass all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.