Refactoring to the js Ajax Module