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 6696709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:22:24+00:00 2026-05-26T06:22:24+00:00

I am new into Facebook application development and also newbie about JavaScript and PHP

  • 0

I am new into Facebook application development and also newbie about JavaScript and PHP programming.

I currently developing a Facebook application but currently stuck with Request Dialog window.

When the Request Dialog appears, I choose friends I want and then click “Send Requests”, the requestCallback(response) are executed and friends who getting requests are notified as expected. But, If I click “Cancel” or the blue-colored close button, the requestCallback(response) is also executed but selected friends are not getting notified about the request.

Here is my code:

function requestCallback(response)
{
    //console.log(response);
    location.href='step2.php';
}

So, whether I click “Cancel” or close button, the script above are still executed (moving to page step2.php I specify.)

What I want is when the user clicking cancel button or close modal window button, the page stay at the same page.

Anyone know how to solve this problem?

Thanks!

  • 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-26T06:22:25+00:00Added an answer on May 26, 2026 at 6:22 am

    You can just check what’s inside the Facebook response object, because it won’t be the same if requests have been sent or not !

    Something like :

    function requestCallback(response)
    {
        if(response && response.request_ids) {
             // Here, requests have been sent, facebook gives you the ids of all requests
             //console.log(response);
             location.href='step2.php';
        } else {
             // No requests sent, you can do what you want (like...nothing, and stay on the page).
        }
    }
    

    Or if you are using the new structure (Request 2.0 Efficient):

    function requestCallback(response)
    {
        if(response && response.request) {
             // Here, requests have been sent, facebook gives you the request and the array of recipients
             //console.log(response);
             location.href='step2.php';
        } else {
             // No requests sent, you can do what you want (like...nothing, and stay on the page).
        }
    }
    

    Look at the structure of the response object to make your condition. The callback is fired even when you hit close in order to have the possibility to notice when your user quits the dialog. It’s up to you to verify if he sent requests, and act like you want ! 🙂

    Also, something important :
    Facebook updated their request system a few weeks ago, making available “Requests 2.0” in your apps settings. It’s turned off by default, but if you activate it, the structure of the response object when sending requests to people will change. So you’d have to update your condition in the callback !

    Everything is explained here :
    http://developers.facebook.com/blog/post/569/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am completely new to Facebook application development, but I've got a straight-forward question.
I have an iframe Facebook application (using Facebook's new JavaScript API) that needs to
Hello guys i am new about this implementing facebook into my app.I check developer's
I wanna implement Facebook connect into my application on android. But i am not
Im new into that asp.net thing, but here goes. I got at ImageButton, and
I was trying to insert new data into an existing XML file, but it's
I'm trying to load a new view into an existing view controller, but I
Howdy. I've been tasked with making a Facebook game, but I'm new to Facebook
I'm currently integrating facebook into my current app and I've succeeded in retrieving the
Does anyone have experience writing a Facebook application using GWT with GAE? I'm new

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.