ajax register function fixed