title: Simulating facebook search using jquery
body: <p>I'm Swadesh, a young software engineer who is always fascinated about facebook applications.</p>
  
  <p>Once I came across facebook search bar which searches for friends, communities, applications, etc.</p>
  
  <p>I just love it, because its so fast and gives you intelligent and instant result.</p>
  
  <p>I tried a similar one using JQuery. The project with a demo can be found <a href="http://itswadesh.wordpress.com/2012/01/19/1366/" rel="nofollow">here</a></p>
  
  <p>Now the issue I’m facing is: I get duplicate records inserted into DOM(from where I search for the string). </p>
  
  <p>The javascript search idea is as follows</p>
  
  <ul>
  <li>On page load, “Load all data of friends from database into DOM”</li>
  <li>Declare an array which will hold the DOM data </li>
  <li>Push the DOM data into the javascript array</li>
  <li>Handle the keyup event which will subsequently search for the javascipt array  object. If not found it will call the ajax function which will collect data from database.</li>
  <li>Push the retrieved data again into the DOM and search from there</li>
  </ul>