Add javascript for dynamic routing