refactoring ajax style