title: Facebook Canvas Apps, New API
body: <p>I'm having some trouble with switching to the new JS API for a number of things with creating applications within FB, specifically the "Tab".</p>
  
  <p><strike></p>
  
  <pre><code>&lt;!--
  function do_perm()
  {
   Facebook.showPermissionDialog('publish_stream,email,offline_access', null);
  }
  //--&gt;
  </code></pre>
  
  <p></strike></p>
  
  <p><strike>This no longer works for me when called via an onclick command. Also, with the new API and an FBML app. How does this exactly work? The documentation is really poor so I am confused when looking at the old wiki, and the new developer site.</p>
  
  <p>Apologies for being pretty vague, but I'm just generally confused with the lack of clear direction with the new API and help would be greatly appreciated.</p>
  
  <p>I'm simply just trying to create a call that prompts for the new style user permission dialog, and oncomplete calls another JS function.</strike></p>
  
  <pre><code>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);
  }
  </code></pre>
  
  <ol>
  <li>I am able to auth the user when they run do_ajax, but this doesn't then go onto call extended permissions.</li>
  <li>Extended permissions are only run once the Tab app is reloaded, and then they can grant them. This isn't desirable as a user isn't likely ot reload the app, then click again.</li>
  <li>Am I able to do this all in one?</li>
  </ol>