Revised ajax function for instant search