refactoring ajax for select box