English 中文(简体)
“请求诊断” 点击Cancel或近海顿时的反馈
原标题:"Request Dialog" requestCallback when clicking Cancel or Close button

我是“Facebook”应用开发新版和“PHP”方案规划的新版。

我目前正在开发一个“Face”应用程序,但目前却 st着“请求迪亚洛”窗口。

当请求迪亚洛出庭时,我选择朋友,然后点击“之友要求”,执行请求书,并通知提出请求的朋友。 但是, 如果我点击“Cancel”或“蓝色 close子”,请求书Callback(答复)也被执行,但选定的朋友没有接到有关请求的通知。

我的守则是:

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

因此,无论是我点击“Cancel”还是近海顿,上述文字仍在执行(移至第2页)。

我所希望的是,当用户点击取消纽顿或接近模式的金顿时,该网页在同一页。

任何人都知道如何解决这一问题?

Thanks!

最佳回答

你只能检查Facebookresponse<>/strong>的标语,因为如果发出要求,它就赢得了同样的 won!

类似:

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).
    }
}

或者如果你正在使用新的结构(Request 2.0 Efective):

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/

问题回答

暂无回答




相关问题
Facebook Connect login dialog not working

I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog: FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:...

Facebook App Profile Tab is Empty ... No Content Displayed?

I can view my application via the http://apps.facebook.com/myapplication/ link and the content shows up correctly. I also added the application as a tab to a facebook page. However, when viewing the ...

Facebook Platform error: "Object cannot be liked"

I m working on a Facebook Application that generates wall posts. In testing these posts, I ve discovered that the Facebook Platform action of "liking" a post is failing. The specific error message ...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once ./facebook-platform/php/facebook.php ; $facebook = new Facebook(my ...

Facebook connect

If I plug in the facebook connect into my website, How can I prevent double signups? Lets say I have a user that s already signed up to my site but he clicked the connect with facebook, is there a ...