I declared a global var to access the data in second view, is this the correct way?