.ajax refactoring