<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Facebook Cookbook &#187; Saidur Rahman</title>
	<atom:link href="http://fbcookbook.ofhas.in/author/bijon/feed/" rel="self" type="application/rss+xml" />
	<link>http://fbcookbook.ofhas.in</link>
	<description>thousands of app development recipes</description>
	<lastBuildDate>Sun, 21 Mar 2010 10:38:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Facebook Iframe  application issues</title>
		<link>http://fbcookbook.ofhas.in/2010/03/21/facebook-iframe-application-issues/</link>
		<comments>http://fbcookbook.ofhas.in/2010/03/21/facebook-iframe-application-issues/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 10:37:49 +0000</pubDate>
		<dc:creator>Saidur Rahman</dc:creator>
				<category><![CDATA[iFrame]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=300</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2010/03/21/facebook-iframe-application-issues/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'Facebook Iframe  application issues';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
Here are the problems that I have faced  while developing my first  iframe application.The problems are very silly but i have to waste so much times to solve the issues. So i want to share some of issues that i faced.
1. POST Submission problem : 
http://forum.developers.facebook.com/viewtopic.php?id=24430
While I submit the post data unfortunately I  do not [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2010/03/21/facebook-iframe-application-issues/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'Facebook Iframe  application issues';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p>Here are the problems that I have faced  while developing my first  iframe application.The problems are very silly but i have to waste so much times to solve the issues. So i want to share some of issues that i faced.</p>
<p><strong>1. </strong><strong><span style="text-decoration: underline;">POST Submission problem : </span></strong></p>
<p><a href="http://forum.developers.facebook.com/viewtopic.php?id=24430"></a><a href="http://forum.developers.facebook.com/viewtopic.php?id=24430">http://forum.developers.facebook.com/viewtopic.php?id=24430</a></p>
<p>While I submit the post data unfortunately I  do not get any post data. I have found that post field is empty. I am very surprised how my $_POST field is empty though it submit the action page.   I have given a sample form of my application.</p>
<p><strong> Posting it via the server url:</strong></p>
<pre name="code" class="php">

&lt;form action=&quot;http://myserver.com/appname&quot; method=&quot;POST&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;test1&quot;&gt;&lt;/input&gt;
&lt;input type=&quot;submit&quot; name=&quot;Submit&quot;/&gt;
&lt;/form&gt;
</pre>
<p>But when I submit this , I cannot get the post data . So I tried by<br />
<strong>Posting it via the app callback url:</strong></p>
<pre name="code" class="php">

&lt;form action=&quot;http://app.facebook.com/appname&quot; method=&quot;POST&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;test1&quot;&gt;&lt;/input&gt;
&lt;input type=&quot;submit&quot; name=&quot;Submit&quot;/&gt;
&lt;/form&gt;
</pre>
<p>After search in  facebook developer wiki,forum and blog , I have known that<br />
while submit the form , iframe lost the session key as there is no session key passed . As a result it lost user id and lost all the post data. That’s why i have to set user_id. So below is the forum post link :<br />
<a href="http://forum.developers.facebook.com/viewtopic.php?id=22929">http://forum.developers.facebook.com/viewtopic.php?id=22929</a><br />
And  here Is how I solve this issue . This my modified form where I added two  hidden fields. One is fb_sig_session_key and another one is user_id.</p>
<p>After search in  facebook developer wiki,forum and blog , I have known that<br />
while submit the form , iframe lost the session key as there is no session key passed . As a result it lost user id and lost all the post data. That’s why i have to set user_id. So below is the forum post link :<br />
http://forum.developers.facebook.com/viewtopic.php?id=22929<br />
And  here Is how I solve this issue . This my modified form where I added two  hidden fields. One is fb_sig_session_key and another one is user_id.</p>
<p><strong>Posting via fb_sig_session_key and user_id </strong></p>
<pre name="code" class="php">

&lt;form action=&quot;http://myserver.com/appname&quot; method=&quot;POST&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;test1&quot;&gt;&lt;/input&gt;
&lt;input type=&quot;hidden&quot; name=&quot;fb_sig_session_key&quot; value=”&lt;?php $_GET[‘fb_sig_session_key’]”&gt;&lt;/input&gt;
&lt;input type=&quot;hidden&quot; name=&quot;user_id&quot; value=”&lt;?php $_GET[‘user_id’]”&gt;&lt;/input&gt;
&lt;input type=&quot;submit&quot; name=&quot;Submit&quot;/&gt;
&lt;/form&gt;
</pre>
<p>So after submit the form here I show how can I set_user and now find the post values.</p>
<pre name="code" class="php">

&lt;?php
if (isset ( $_REQUEST [&#039;kb_fb_sig_session_key&#039;] )) {
$this-&gt;fb_sig_session_key = $_REQUEST [&#039;fb_sig_session_key&#039;];
}

if (isset ( $_REQUEST [&#039;user_id&#039;] )) {
$this-&gt;uid = $_REQUEST [&#039;user_id&#039;];
}

if ($this-&gt;uid != &#039;&#039;) {
$this-&gt;facebook-&gt;set_user ($this-&gt;uid, $this-&gt;kb_fb_sig_session_key );
}
$this-&gt;facebook-&gt;set_user ($this-&gt;uid, $this-&gt;fb_sig_session_key );
?&gt;
</pre>
<p><strong><strong><strong><strong>2. <span style="text-decoration: underline;">Application  Link  problem</span> : </strong></strong></strong></strong></p>
<p><strong><strong><strong>While I click on any link in my iframe application , I have found that it reloads the whole facebook page again in the iframe canvas. I just use this type of code and found the problem load  .</strong></strong></strong></p>
<p><strong><strong><strong>&lt;a href=&#8221;http://apps.facebook.com/MyApp/invite.php&#8221;&gt;Invite&lt;/a&gt;</strong></strong></strong></p>
<p><strong><strong><strong>I found the solution in this thread : <a href="http://forum.developers.facebook.com/viewtopic.php?pid=208220">http://forum.developers.facebook.com/viewtopic.php?pid=208220</a></strong></strong></strong></p>
<p><strong><strong><strong>Only add the taget=”__top” into the anchor.</strong></strong></strong></p>
<p><strong><strong><strong>So I add target=”_top”. &lt;a href=&#8221;http://apps.facebook.com/MyApp/invite.php&#8221;&gt;Invite&lt;/a&gt;.   And now it work.</strong></strong></strong></p>
<p><strong><strong><strong><strong>3</strong>. <strong>i<span style="text-decoration: underline;">frame size problem</span>  :</strong></strong></strong></strong></p>
<p><strong><strong><strong>I have faced problem to resize my frame application. Initially when page load the frame size is correct. But when I show the facebook profile photo of users , then find that it does not resize. I do not see the footer and it cut down. We have solve this problem by adding  javascript setTimer to resize the height. You have seen similar type problem here :<a href="3.	iframe size problem  :                        I have faced problem to resize my frame application. Initially when page load the frame size is correct. But when I show the facebook profile photo of users , then find that it does not resize. I do not see the footer and it cut down. We have solve this problem by adding  javascript setTimer to resize the height. You have seen similar type problem here : http://forum.developers.facebook.com/viewtopic.php?pid=17541#p17541"> http://forum.developers.facebook.com/viewtopic.php?pid=17541#p17541</a></strong></strong></strong></p>
<p><strong><strong><strong><strong>4. </strong> <strong><span style="text-decoration: underline;">setting issues </span>: </strong></strong></strong></strong></p>
<p><strong><strong><strong>I think to set up my application as an iframe application, I do not need to set up the connect url. But when I do not set up connect url I see blank page. So when I set up the call back url , I have found that my application working.</strong></strong></strong></p>
<p><strong><strong><strong><img class="alignnone size-medium wp-image-301" title="setting" src="http://fbcookbook.ofhas.in/wp-content/uploads/2010/03/setting-300x121.jpg" alt="setting" width="300" height="121" /></strong></strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2010/03/21/facebook-iframe-application-issues/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>how to  trigger multiple onload functions when divs  are  loaded by FBJS</title>
		<link>http://fbcookbook.ofhas.in/2009/02/15/how-to-trigger-multiple-onload-functions-when-divs-are-loaded-by-fbjs/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/15/how-to-trigger-multiple-onload-functions-when-divs-are-loaded-by-fbjs/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 16:56:12 +0000</pubDate>
		<dc:creator>Saidur Rahman</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[FBJS]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=275</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/15/how-to-trigger-multiple-onload-functions-when-divs-are-loaded-by-fbjs/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to  trigger multiple onload functions when divs  are  loaded by FBJS';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>




  
facing trouble to trigger multiple onload event to work  FBJS does not allow acess to the window object. So how can onload event fire when &#60;div&#62; is loaded on canvas. also FBJS is executed after the entire page has been loaded. so really shouldn&#8217;t matter where you call the function within your [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/15/how-to-trigger-multiple-onload-functions-when-divs-are-loaded-by-fbjs/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to  trigger multiple onload functions when divs  are  loaded by FBJS';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-3649773907774827";
/* 468x15, created 9/26/09 */
google_ad_slot = "6695465500";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]><span class="mceItemObject"   classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></span> <mce:style><!  st1\:*{behavior:url(#ieooui) } --> <!--[endif]--><!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-language:AR-SA;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --><!--[if gte mso 10]> <mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} --> <!--[endif]--></p>
<p class="MsoNormal">facing trouble to trigger multiple onload event to work <span> </span>FBJS does not allow acess to the window object. So how can onload event fire when &lt;div&gt;<span> </span>is loaded on canvas. also FBJS is executed after the entire page has been loaded. so really shouldn&#8217;t matter where you call the function within your canvas page file. however let’s see how can we trigger on load for multiple div.</p>
<p class="MsoNormal">
<p class="MsoNormal">In this example we create two div which load by onload. One &lt;div=’msg’&gt; is for content a message and another &lt;div=’ ajax’&gt; which load the value by ajax way.</p>
<p class="MsoNormal">
<p class="MsoNormal"><span> </span>For that reason in FBJS we create a varraible <span> </span>array and pushing <span> </span>two functions on that array variable.</p>
<pre name="code" class="php">

var onload = [];

onload.push(function() {
//ONLOAD STUFFS HERE
msg_laod();
do_ajax();

});

&lt;/script&gt;
</pre>
<p class="MsoNormal">now we define the two functions. The message load function just simply display a text message on &lt;div id=’msg’&gt;. and do_ajax() function display the value by ajax call.</p>
<p class="MsoNormal">
<pre name="code" class="php">

&lt;script&gt;
function msg_laod()
{
document.getElementById(&#039;msg&#039;).setInnerHTML(&#039;test message content&#039;);

}

function do_ajax()
{
var ajax = new Ajax();
ajax.ondone = function(data) {
document.getElementById(&#039;req&#039;).setInnerFBML(data);
}
ajax.requireLogin = 1;
ajax.responseType = Ajax.FBML;
ajax.post(&#039;http://www.techsmashing.com/banglakeyboard/adduser.php&#039;);
}            ajax.post(.....display.php&#039;); // ajax callback url
}&lt;/script&gt;
</pre>
<p class="MsoNormal">
<p class="MsoNormal">now we trigger on the onload event . by pushing functions into an array and executing them at the bottom of the page it ensures that the elements are indeed in the dom tree.  here we add setTimeout function to to make sure the browser is fully loaded. It allows 100 miliseconds. because the rest of the page to load (facebook footer and such).   increasing the 100 milisecond limit can solve some of these problems.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<pre name="code" class="php">
&lt;/p&gt;&lt;/p&gt;

&lt;script&gt;
//the very last thing on the page
setTimeout (function() {
for(var a = 0;a &lt; onload.length;a++) {onload[a]();}
}, 100);
&lt;/script&gt;
</pre>
<p class="MsoNormal">
<p class="MsoNormal">in this way we can easily load onload functions in the div. we combine the whole code and looks like that:</p>
<pre name="code" class="php">

&lt;?php
include_once &#039;config.php&#039;;
?&gt;
&lt;script&gt;
var onload = [];
onload.push(function() {
//ONLOAD STUFFS HERE
msg_laod();
do_ajax();

});

function msg_laod()
{
document.getElementById(&#039;msg&#039;).setInnerHTML(&#039;test message content&#039;);

}

function do_ajax()
{
var ajax = new Ajax();
ajax.ondone = function(data) {
document.getElementById(&#039;req&#039;).setInnerFBML(data);
}
ajax.requireLogin = 1;
ajax.responseType = Ajax.FBML;
ajax.post(&#039;ajax callback url&#039;);
}

&lt;/script&gt;
&lt;div id=&quot;msg&quot; style=&quot;width:398px;height:298px;&quot;&gt;test message content&lt;/div&gt;
&lt;div id=&quot;ajax&quot; style=&quot;width: 398px; height: 298px;&quot;&gt; &lt;/div&gt;

&lt;script&gt;
//the very last thing on the page
setTimeout(function() {
for(var a = 0;a &lt; onload.length;a++) {onload[a]();}
}, 100);
&lt;/script&gt;
</pre>
<p><strong>reference</strong> :</p>
<p><a href="http://forum.developers.facebook.com/viewtopic.php?id=5117">http://forum.developers.facebook.com/viewtopic.php?id=5117</a><br />
<script type="text/javascript"><!--
google_ad_client = "pub-3649773907774827";
/* 468x15, created 9/26/09 */
google_ad_slot = "6695465500";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2009/02/15/how-to-trigger-multiple-onload-functions-when-divs-are-loaded-by-fbjs/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>dealing with ajax  on FBConnect</title>
		<link>http://fbcookbook.ofhas.in/2009/02/11/dealing-with-ajax-on-fbconnect/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/11/dealing-with-ajax-on-fbconnect/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 11:21:29 +0000</pubDate>
		<dc:creator>Saidur Rahman</dc:creator>
				<category><![CDATA[FB Connect]]></category>
		<category><![CDATA[FBJS]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=209</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/11/dealing-with-ajax-on-fbconnect/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'dealing with ajax  on FBConnect';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
  problem : 
need to store users information by ajax call while on connect . but face problems using fbjs ajax calls using on connect .some times face the problem to send ajax request  in the forum also get related type of problems . like:
http://forum.developers.facebook.com/viewtopic.php?id=28153
http://forum.developers.facebook.com/search.php?search_id=92171720
let’s see a quick solution by a common example.
solution:
here we [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/11/dealing-with-ajax-on-fbconnect/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'dealing with ajax  on FBConnect';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]><span class="mceItemObject"   classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></span> <mce:style><!  st1\:*{behavior:url(#ieooui) } --> <!--[endif]--><!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman"; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-language:AR-SA;} a:link, span.MsoHyperlink 	{color:blue; 	text-decoration:underline; 	text-underline:single;} a:visited, span.MsoHyperlinkFollowed 	{color:purple; 	text-decoration:underline; 	text-underline:single;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --><!--[if gte mso 10]> <mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} --> <!--[endif]--><strong>problem : </strong><br />
need to store users information by ajax call while on connect . but face problems using fbjs ajax calls using on connect .some times face the problem to send ajax request  in the forum also get related type of problems . like:</p>
<p><a href="http://forum.developers.facebook.com/viewtopic.php?id=28153">http://forum.developers.facebook.com/viewtopic.php?id=28153</a><br />
<a href="http://forum.developers.facebook.com/search.php?search_id=92171720">http://forum.developers.facebook.com/search.php?search_id=92171720</a></p>
<p>let’s see a quick solution by a common example.</p>
<p><strong>solution:</strong></p>
<p>here we look at the after connect get user profile picture and name by connect.</p>
<p>we create a script connect.php and include the  config  file .connect.php</p>
<pre name="code" class="php">

&lt;?php
/*
* include config file
*/
?&gt;

&lt;div id=&quot;user&quot;&gt; &lt;/div&gt;
&lt;fb:login-button onlogin=&quot;update_user_box();&quot;&gt;&lt;/fb:login-button&gt;
&lt;script type=&quot;text/javascript&quot;&gt;FB.init(&quot;key&quot;, &quot;xd_receiver.php&quot;); &lt;/script&gt;&lt;span style=&quot;display: block; padding-left: 6em;&quot;&gt;&lt;span&gt;
</pre>
<p>now it&#8217;s look like that:</p>
<p><img class="alignnone size-full wp-image-210" title="fb_conn_ajax" src="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/fb_conn_ajax.jpg" alt="fb_conn_ajax" /><br />
here in the connect button add onlogin function update_user_box().while click on connect then this function will call and update user by profile picture and name in the user id div.</p>
<p>in that update_user_box() function we will get the profile picture and name by calling ajax. So later on we can do anything by ajax.to call the ajax we will do it by jquery. Here I cannot do it by the fbjs  ajax method. For that reason I add jquery and other scripts.</p>
<pre name="code" class="php">

&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
</pre>
<p>now update update_user_box</p>
<pre name="code" class="php">

&lt;script type=&quot;text/javascript&quot;&gt;
function update_user_box()

{

Var url = “http://www.t...com.display.php”; // ajax url which is here display.php

$.ajax({
type: &quot;POST&quot;,
url:url,
data: &quot;save=yes&quot;,
success: function(msg){
var user_box = document.getElementById(&quot;user&quot;);
user_box.innerHTML =msg;

}
});
}
</pre>
<p>now create the display.php Which call by ajax.</p>
<p>In the display php also include config file which include facebook client library</p>
<p>here is code</p>
<pre name="code" class="php">
&lt;?php
define(MAIN_PATH, realpath(&#039;.&#039;));
include_once MAIN_PATH.&#039;/init.php&#039;;
$fb_uid = facebook_client()-&gt;get_loggedin_user();
echo &#039;&lt;span&gt; &lt;fb:profile-pic uid=&#039;.$fb_uid.&#039; facebook-logo=true&gt;&lt;/fb:profile-pic&gt; Welcome, &lt;fb:name uid=&#039;.$fb_uid.&#039; useyou=false&gt;&lt;/fb:name&gt;. You are signed in with your Facebook account.&lt;/span&gt;&#039;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

?&gt;
&lt;span style=&quot;display: block; padding-left: 6em;&quot;&gt;&lt;span&gt;
</pre>
<p>this display.php returns the user profile picture and name. and it&#8217;s look like that.</p>
<p><img class="alignnone size-full wp-image-220" title="fb_conn_ajax3" src="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/fb_conn_ajax3.jpg" alt="fb_conn_ajax3" width="387" height="104" /></p>
<p>that&#8217;s it <img src='http://fbcookbook.ofhas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2009/02/11/dealing-with-ajax-on-fbconnect/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
