Facebook Application FBJS help using setInnerXHTML + array

I have a canvas Facebook application, I have all user friends in JS array, and I want to show user friends picture + name one after one, after clicking NEXT button, the code i written is not working :

var friends = new Array(); //Friends Array
for($i=0; $i<= $limit; $i++) //Add to JS array all friends id's from PHP array
echo 'friends['.$i.'] = '.$appfriends[$i][uid].';';

I'm passing to this function the first Array --> 0 to increment it each time Next Friend clicked, and show the next friend picture then change Next Friend URL with the next friend Array Key

function get_friends(id){ 
var fid;
fid = id++;
var fid_img = "<img src=\"https://graph.facebook.com/"+friends[fid]+"/picture\"/>";
var fid_link = "<a href=\"#\" onclick=\"get_friends("+fid+"); return false;\">Next Friend</a>";

//Changing Friend Image

//Changing Next Friend URL

<div id="show_friends">
<img src="https://graph.facebook.com/<?php echo $appfriends[0][uid];?>/picture"/>


<span id="next_friend"><a href="#" onclick="get_friends(0); return false;">Next Friend</a></span>

FBJS Documentation : http://developers.facebook.com/docs/fbjs

Sorry for my bad english. Thanks in advance!


I solved the problem, to create an Array using FBJS you have to use

var arrayname = [];

//instead of

var arrayname = new Array;

Need Your Help

How to change password using TortoiseSVN?

svn passwords tortoisesvn

I need to change my SVN password. I am using TortoiseSVN client. I am not able to find the password change or add user option.

What's the difference between jQuery .live() and .on()

jquery jquery-live jquery-1.7

I see there's a new method .on() in jQuery 1.7 that replaces the .live() in earlier versions.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.