Facebook Canvas Apps, new API

I had problems switching to the new JS API for several things when creating applications inside FB, in particular in "Tab".

<!--
function do_perm()
{
 Facebook.showPermissionDialog('publish_stream,email,offline_access', null);
}
//-->

Strike>

This no longer works for me when called through the onclick command. In addition, with the new API and FBML application. How exactly does it work? The documentation is really poor, so I'm confused looking at the old wiki and the new developer site.

I apologize for being rather vague, but they simply confuse me with the lack of a clear direction with the new API, and I will be very grateful to us with gratitude.

I'm just trying to create a call that asks for a dialog box with permissions to use the new style, and oncomplete calls another JS function.

function do_permission(perms) {
 Facebook.showPermissionDialog(perms, done_permissions);
}

function done_permissions(permission_granted) {
 //new Dialog().showMessage("Message", "Bo!","Ok");
}

function do_ajax(type, val) {
 var ajax = new Ajax();
 ajax.responseType = type;

 ajax.onerror = function(error) {
  new Dialog().showMessage("Message", "Ajax Error", "Ok");
 };

 ajax.ondone = function(data) {
  new Dialog().showMessage("Message", "Ajax Success", "Ok");
     do_permission('publish_stream,email,offline_access,user_location,user_hometown');
 }

 var params = { 'key1': type, 'key2': val }; 

 ajax.requireLogin = true;
 ajax.post('http://example.com', params);
}
  • , do_ajax, , .
  • Tab, . , , .
  • ?
+3

Source: https://habr.com/ru/post/1744664/


All Articles