<?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; FBJS</title>
	<atom:link href="http://fbcookbook.ofhas.in/tag/fbjs/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>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>
		<item>
		<title>displaying a &#8220;friend selector&#8221; in FBConnect application &#8211; a custom component for you</title>
		<link>http://fbcookbook.ofhas.in/2009/02/10/displaying-a-friend-selector-in-fbconnect-application-a-custom-component-for-you/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/10/displaying-a-friend-selector-in-fbconnect-application-a-custom-component-for-you/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 11:48:29 +0000</pubDate>
		<dc:creator>Hasin Hayder</dc:creator>
				<category><![CDATA[FB Connect]]></category>
		<category><![CDATA[FBJS]]></category>
		<category><![CDATA[FQL]]></category>
		<category><![CDATA[iFrame]]></category>
		<category><![CDATA[xfbml]]></category>
		<category><![CDATA[FBML]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=183</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/10/displaying-a-friend-selector-in-fbconnect-application-a-custom-component-for-you/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'displaying a &#8220;friend selector&#8221; in FBConnect application &#8211; a custom component for you';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
ok, i have learned my lesson while integrating  &#60;fb:multi-friend-selector [condensed] /&#62; and &#60;fb:multi-friend-input /&#62; in an iFrame app where i was rying to render it uwing &#60;fb:serverfbml&#62;. i was designing a page where users of your application can select an item, then some of their friends and finally submit the form to the handler [...]]]></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/10/displaying-a-friend-selector-in-fbconnect-application-a-custom-component-for-you/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'displaying a &#8220;friend selector&#8221; in FBConnect application &#8211; a custom component for you';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p>ok, i have learned my lesson while integrating  &lt;fb:multi-friend-selector [condensed] /&gt; and &lt;fb:multi-friend-input /&gt; in an iFrame app where i was rying to render it uwing &lt;fb:serverfbml&gt;. i was designing a page where users of your application can select an item, then some of their friends and finally submit the form to the handler script (might be javascript routine too!)</p>
<p>as &lt;fb:serverfbml /&gt; renders the &lt;fb:request-form /&gt; inside another iframe (thats right &#8211; iframe inside an iframe) so its quite tough job to pass external data to any of the DOM element inside those iframe. later, i tried to dynamically render the &lt;fb:serverfbml /&gt; with the help of AJAX and XFBML.parseDOMTree() but no luck. the surprising fact that everything out there was renedring properly but not the request form (when returned via ajax). so finally i did it with FQL and by building a custom friend selector component. so here it is</p>
<pre name="code" class="javascript">

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:fb=&quot;http://www.facebook.com/2008/fbml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Custom Friend Selector&lt;/title&gt;
&lt;/head&gt;
&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;
&lt;body&gt;
&lt;fb:login-button&gt;&lt;/fb:login-button&gt;&lt;br/&gt;&lt;br/&gt;
Hello &lt;span id=&quot;me&quot; uid=&quot;503274632&quot; useyou=&#039;false&#039;&gt;&lt;/span&gt; And here is your friend list&lt;br/&gt;

&lt;div id=&quot;friends&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;script type=&quot;text/javascript&quot;&gt; 

function loadFriends(uid) {

    FB.XFBML.Host.autoParseDomTree = false;
    FB.XFBML.Host.addElement(new FB.XFBML.Name(document.getElementById(&quot;me&quot;)));

    FB_RequireFeatures([&quot;CanvasUtil&quot;], function(){  FB.CanvasClient.startTimerToSizeToContent(); });
    var api = FB.Facebook.apiClient;
    api.fql_query(&quot;SELECT uid, first_name, last_name FROM user WHERE  uid IN (SELECT uid2 FROM friend WHERE uid1 = &quot;+uid+&quot;) order by first_name&quot;, function(result, ex) {

        data = &quot;&lt;table&gt;&quot;;
        for (i=0;i&lt;result.length;i++)
        {
            data += &quot;&lt;tr&gt;&lt;td&gt;&lt;input type=&#039;checkbox&#039; value=&#039;&quot;+result[i].uid+&quot;&#039; name=&#039;friends[]&#039; id = &#039;friend&quot;+result[i].uid+&quot;&#039; /&gt;&lt;/td&gt;&lt;td&gt;&quot;+ result[i].first_name + &quot; &quot; + result[i].last_name+&quot;&lt;/td&gt;&lt;/tr&gt;&quot;;
        }
        data +=&quot;&lt;/table&gt;&quot;;
        $(&#039;#friends&#039;).css({&quot;overflow-y&quot;:&quot;scroll&quot;,&quot;height&quot;:&quot;200px&quot;,&quot;width&quot;:&quot;300px&quot;,&quot;border&quot;:&quot;1px solid #ccc&quot;});
        $(&#039;#friends&#039;).html( data);

    });
}

FB.init(&quot;api_key&quot;, &quot;xd_receiver.php&quot;,{&quot;ifUserConnected&quot;:loadFriends});

&lt;/script&gt;
</pre>
<p>and here is how it looks, </p>
<p><a href="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/picture-151.png"><img src="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/picture-151-300x266.png" alt="picture-151" title="picture-151" width="300" height="266" class="alignnone size-medium wp-image-191" /></a></p>
<p>you will find it useful in your FBConnect applications <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/10/displaying-a-friend-selector-in-fbconnect-application-a-custom-component-for-you/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
