refactored dashboard javascript to prevent multiple submissions and intervals