Each FB.UI has a callback function, and it also applies to the dialog box.
See this document for general syntax for FB.UI.
But the problem is that other methods are FB.UI, the SEND method has no return value.
According to the documentation on Facebook,
If the message is sent successfully, the user will be redirected to redirect_uri. Otherwise, an error will be shown. Unlike the Like button, it is missing by itself.
So, if the message was sent successfully and you do not have redirect_uri, then the callback will not have anything as a return value and, otherwise, it will send an error message when sending the message.
To confirm that the callback is working, use the following code,
FB.ui({ method: 'send', name: 'People Argue Just to Win', link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html', }, function(response){ alert(response); if(response != null){ alert('user clicked send'); }else{ alert('user clicked cancel'); } });
when you click "Send" and the message is sent successfully, it will warn an empty line and when you click "Cancel", the warning "null" is issued.
source share