Functionality to DB search for AJAX