Refactor the ajax methods as a Class