In my application after getting my application Authorized by Facebook I get all their friends info which is returned in an array.
I sort this array in order of the friends whose birthday is closest to the current date.(code not shown for this)
I want to display the information for 20 friends at a time as some users may have hundreds of friends.
Currently I am putting all of the friends on the page at one time.
Here is the code I was using to loop through the entire array and put the info on the page
$.each(json.data,function(i,fb){
var pic_url = "http://graph.facebook.com/"+fb.id+"/picture";
json_details = {name: fb.name, provider_user_id: fb.id, birthday: fb.birthday, provider_name : 'Facebook' };
var celebrant_details = escape(JSON.stringify(json_details) );
html += "<form id='new_celebration"+fb.id+"' method='post' action='/celebrations' accept-charset='UTF-8'>";
html += "<input type='hidden' id='friend' value='"+celebrant_details +"' name='celebrant_details' />"
html += "<input type='hidden' id='manager' value='"+manager_details +"' name='manager_details' />"
html += "<li>" + fb.name + "</li>";
if(fb.birthday != null){ html += "<li>" + fb.birthday + "</li>"; } //don't show if don't have a birthday
html += "<li><img src="+pic_url+" /></li>";
html += "<input class='button-mini-subtle submit' type='submit' value='select' alt='select' >";
html += "</form>";
});//.each loop
I am a NOOB so would appreciate some guidance.
I want to give the users a button they can click to display more users from the array. So I know I need to create some kind of a function call and I need to know where I am in the array.
How can I get this kind of behavior?