你只能检查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/