add register action and refactor ajaxbase