php - Facebook Application FBJS help using setInnerXHTML + array -


i have canvas facebook application, have user friends in js array, , want show user friends picture + name 1 after one, after clicking next button, code written not working :

<script>  <!--  var friends = new array(); //friends array <?php for($i=0; $i<= $limit; $i++) //add js array friends id's php array { echo 'friends['.$i.'] = '.$appfriends[$i][uid].';'; } ?>  /* i'm passing function first array --> 0 increment each time next friend clicked, , show next friend picture change next friend url 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 document.getelementbyid('show_friends').setinnerxhtml(fid_img);  //changing next friend url document.getelementbyid('next_friend').setinnerxhtml(fid_link); } //-->  </script>  <div id="show_friends"> <img src="https://graph.facebook.com/<?php echo $appfriends[0][uid];?>/picture"/> </div>  <br>  <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 bad english. in advance!

i solved problem, create array using fbjs have use

<script>  <!-- var arrayname = [];  //instead of  var arrayname = new array; //-->  </script> 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -