This study proposes Q-learning-based dynamic routing algorithms to address routing and spectrum allocation challenges in elastic optical networks (EONs). An adaptive reinforcement learning framework is employed to enable real-time learning and decision-making under varying network conditions. The proposed Q-learning algorithm takes into consideration both the available spectrum and delay constraints in real-time to make informed decisions during routing and spectrum allocation, resulting in improved network capacity and reduced blocking rates. Following the Q-learning routing algorithm, two commonly used spectrum allocation methods, namely first fit and last fit, are applied. Simulation results demonstrate that the proposed method yields a lower blocking probability compared to using a combination of K shortest path routing and classical spectrum allocation strategies.