refactored ajax request into autocomplete