title: Retrieving search data from database using jQuery autocomplete?
body: <p>I am using jQuery UI Autocomplete plugin for better data input in my ASP.NET web application.</p>
  
  <p><a href="http://jqueryui.com/demos/autocomplete/" rel="nofollow">http://jqueryui.com/demos/autocomplete/</a></p>
  
  <p>However, I think I have somehow lost in this plugin.
  I would like to ask what I should do in order to use this autocomplete function with the data retrieve from database?</p>
  
  <p>I expect Ajax should be used for the real-time search,
  but I have no idea how it can be done after looking at the demo in the website above.</p>
  
  <p>Thanks so much.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Here is the code I have tried, doesn't work, but no error in firebug too.</p>
  
  <pre><code>                $('#FirstName').autocomplete({
                      source: function (request, response) {
                          $.ajax({
                              url: "/Contact/FirstNameLookup?firstName=",
                              type: "POST",
                              data: {
                                  "firstName": $('#FirstName').val() 
                              },
                              success: function (data) {
                                  response($.map(data, function (item) {
                                      return {
                                          label: item.FirstName,
                                          value: item.FistName
                                      }
                                  }));
                              }
                          });
                      }
                  });
  </code></pre>