Modal - same view, different data

What is the proper way of designing a page and loading different content depending on what the user has clicked?
I know I can load the different content to the local storage and then load it into the view, but it doesn’t sound right.
Is there a better way?