The Little Guy Posted November 6, 2008 Share Posted November 6, 2008 I'M not sure how I should go about this... I would like to have a search box, where a user can search his/her friends list. Would you: a. Use AJAX to search for the users friends that start with what ever the user types into the text box. b. Preload all of the users friends at page load into an array, and search the array. c. Something different Quote Link to comment Share on other sites More sharing options...
corbin Posted November 6, 2008 Share Posted November 6, 2008 A could potentially use less bandwidth. Unless in the same page load, they decide to find a ton of their friends. Quote Link to comment Share on other sites More sharing options...
xtopolis Posted November 7, 2008 Share Posted November 7, 2008 Depends what they are searching their Flist for.. Just to view their friends web pages? Bring up contact information about a friend (not all friends post the same type of info). Live chat? Still, thinking about it, Ajax would probably be best for displaying results that lead to page navigation. (something for the user to click on to go somewhere else) Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 7, 2008 Author Share Posted November 7, 2008 If you have used facebook, on your home page, there is a search box (top right) and when you type it lists your friends, I want something like that. What they have seems too fast to be AJAX, but I could be wrong. Quote Link to comment Share on other sites More sharing options...
xtopolis Posted November 7, 2008 Share Posted November 7, 2008 Yea, I have a FB. I'm fairly certain it's ajax, can't look at the code atm, at work, but I'm sure you could look. I wouldn't say it's too fast at all, if anything it probably does cache things locally though. You have a set amount of friends, groups, etc... I wouldn't be surprised if it caches the predictable searches.. But then again, they do have 1000s of servers, so it could just be really fast Ajax. Test it? Start a search so that you get a result.. then unplug/disable your inet, keep typing and see if it works or errors. Quote Link to comment Share on other sites More sharing options...
corbin Posted November 7, 2008 Share Posted November 7, 2008 Hrmm wonder what search_friend_source is. Don't feel like finding it in the 123819203890 JS files on Facebook's site. It has to be preloading it somehow.... Cause I don't see any requests (besides images) when the friends pop down. I would guess that they're loaded the first time the search is used.... Dunno. Hrmm looked more deeply into it, and it turns out when you first click on the search box, it loads all of your friends. Firebug owns. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 7, 2008 Author Share Posted November 7, 2008 does it load them into a javascript array? Quote Link to comment Share on other sites More sharing options...
corbin Posted November 7, 2008 Share Posted November 7, 2008 I would presume so. Has to be stored somewhere. Actually might be an object. Yeah, probably an object since JSON data is returned from the request. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.