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

  • Home
  • SEARCH
  • 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 7976821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:00:47+00:00 2026-06-04T09:00:47+00:00

I have an ‘Add To Timeline’ button and I can already add posts to

  • 0

I have an ‘Add To Timeline’ button and I can already add posts to the timeline using another function, but now I want to be able to obtain the requestID of an action so that I can delete it from another javascript function I have. I been searching everywhere but can’t find a good example so that I can learn how to obtain the ID, I’m still confused on how to do it. This is the code:

       <script type="text/javascript">
       function deleteRead(requestId)
       {        
       FB.api(
             requestId,
               'delete',
                function(response) {
                 if (!response || response.error) {
                        alert('error...');
                 } else {
                     alert('Successfully Deleted!');
                     }
                  });
             }</script>

Adding the Action ID number of a post directly works and I’m able to delete the post on my timeline. But I have to make it where it automatically obtains the id for each post.

Do I have to use the PHP SDK in order to obtain the requestID? This is the other code I am using:

            <div id="fb-root"></div>
             <script type="text/javascript">
              window.fbAsyncInit = function() {

                 FB.init({
                 appId      : 'I-have-my-app-ID-here', // App ID
                 status     : true, // check login status
                 cookie     : true, // enable cookies to allow the server to access the session
                 xfbml      : true  // parse XFBML
                 }); 

             };

              // Load the SDK Asynchronously
             (function(d){
                 var js, id = 'facebook-jssdk'; 
                 if (d.getElementById(id)) {return;}
                 js = d.createElement('script'); js.id = id; js.async = true;
                 js.src = "//connect.facebook.net/en_US/all.js";
                 d.getElementsByTagName('head')[0].appendChild(js);
                  }(document));   
                 </script>

Even better, Is there a way where I can grab the requestID through PHP and pass it into a variable? depending on the post (if it’s added to timeline), so that I can replace it with “requestID” to something like:

             <?php echo $requestID; ?>

This way I can use the php code inside of my javascript where the requestID is and plus incase you want to use that same requestID that is obtained for something else in that same page. Example: if the post is added to Timeline it will show it’s request ID number on that post page, incase you want to show the delete button only if its added to timeline, if it’s not added, then don’t show the delete button using a conditional statement.

  • 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-06-04T09:00:48+00:00Added an answer on June 4, 2026 at 9:00 am

    There are two ways of doing this:

    • Store the IDs in a database for each action. This is not ideas as actions can be deleted from Facebook and can make it out of sync with your database.
    • Query the user’s actions in real-time and use that to show a list of actions to delete. This is preferred.

    Sample code:

    // get activity from Facebook
    $actions = $facebook->api('/me/' . $action_id );
    // get ID of last action
    echo $actions[0]['id'] );
    

    You can then grab the ID of the post from above (e.g. $actions[0]['id']) and pass it to your JavaScript function or create a PHP function to delete the action. Optionally, you can loop through $actions to search if a particular action already exists, matching by URL, e.g.

    if ( $actions[0]['data']['article']['url'] == $current_url ) {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have any one tried to activate fancybox thumbnail gallery using a button or an
Have done some working samples using Backbone Router, but is there a way to
Have a matrix report now that has Position, Hours and Wages for a location
have not tested on windows. but in ubuntu when u disconnect from the network,
Have you ever had to justify the choice over using .NET instead of Java
**Have it working now. I forgot to populate the Array List. How embarrassing. I'm
Have converted devise new session from erb to Haml but doens't work, this is
Have searched the database but need to specifically sum(of hours flown or days off)in
have anyone can tell me what syntax error on this actionscript (actionscript3.0)? var rotY:
Have finally got a responsive site working (of a fashion). What I want to

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.