 link.wrap(' '); resultsList.append(link.parent()); }); // The Ajax request will return at the most 00 results. // If there are more than 00, let's link to the search results page. if(data.results_count > 00) { resultsList.append(' See all results (' + data.results_count + ') '); } resultsList.fadeIn(000); } }); } }); }); // Clicking outside makes the results disappear. $('body').bind('click', function(){ $('.search-results').hide(); }); }); 