$.ajax refactored