I have a situation where I call Facebook.showPermissionDialog( offline_access ...) then later I make an ajax.post call. The ajax.post call fails if the call to the permission dialog was made prior. But it succeeds when the permission dialog was not called prior. Is anyone aware of some relationship between this dialog and ajax.post?
If you want to check out the problem firsthand, visit my app at http://apps.facebook.com/rails_dev (THIS IS A FACEBOOK APP SO YOU MUST GRANT ACCESS TO YOUR PROFILE).
Here s the code that calls Facebook.showPermissionDialog():
<?php
echo $this->jsInit($config);
if(!$userNamespace->newGame) {
$log->debug( NOT new game, calling turnResume() );
echo setVarBalance( . $this->gamePlayerData[ funds ] . ); ."
";
echo turnResume(); ."
";
}
echo $this->drawTrack($this->routeData, $this->trainData);
echo $this->drawCityGoods($this->cityGoodsData);
//$link = startSetCity() ; //$config->url->absolute->fb->canvas . /turn/start-set-city ;
echo $this->drawCitiesAjax($this->cityDescData);
$log->debug( view: end start-select-city );
if(!$facebook->api_client->users_hasAppPermission( offline_access , $this->fbUserId)):
?>
var dialog = new Dialog().showMessage( Constant Authorization , Rails Across Europe is about to request Constant Authorization to your account. If you don t give us constant authorization, Facebook will eventually cause your game to timeout, thereby losing all game information. By granting this authorization, Facebook will not cause your game to timeout. This is the only reason we need this authorization. );
dialog.onconfirm = function() {
Facebook.showPermissionDialog( offline_access , null, false, null);
}
<?php
endif;
?>[
Here s the FBJS code that calls ajax.post:
switch(state) {
case START_SET_CITY:
//new Dialog().showMessage( test , START_SET_CITY );
//console.time( start_set_city );
ajax.responseType = Ajax.JSON;
ajax.ondone = function(data) {
//console.time( ondone );
//new Dialog().showMessage( in ajaxSetCity.ondone );
//new Dialog().showMessage( test , city= + dump(data.city, 3) + ::: train= + dump(data.train, 3));
drawCityAjax(data.city, data.train);
setVarBalance(data.funds);
ajax.responseType = Ajax.JSON;
ajax.post(baseURL + /turn/start );
//console.timeEnd( ondone );
};
ajax.post(baseURL + /turn/start-set-city , param); // <=== THIS IS THE AJAX CALL THAT FAILS
var actionPrompt = document.getElementById( action-prompt );
var innerHtml = <span><div id="action-text">Build Track: Select a city where track building should begin</div> +
<div id="action-end"> +
<input type="button" value="End Track Building" id="next-phase" onClick="moveTrainAuto();" /> +
</div></span> ;
actionPrompt.setInnerXHTML(innerHtml);
var btn = document.getElementById( next-phase );
btn.addEventListener( click , moveTrainAutoEvent);
state = TRACK_CITY_START;
//console.timeEnd( start_set_city );
// get funds balance from backend and call setVarBalance()
break;